Skip to content

Add configurable log rotation naming via template #3

@pmonday

Description

@pmonday

Description

The current default log rotation naming uses a zero-padded sequence number pattern (e.g., audit-log.jsonlaudit-log.002.jsonlaudit-log.003.jsonl).

We need to allow users to configure the rotation naming convention via a template string passed to Rotate() or Log configuration.

Proposed Approach

Add a LogOption or configuration that accepts a template string with variables like:

  • {{.Base}} - original filename without extension
  • {{.Ext}} - file extension
  • {{.Seq}} - zero-padded sequence number
  • {{.Timestamp}} - rotation timestamp
  • {{.PrevPath}} - previous log path

Example template: "{{.Base}}.{{.Seq}}{{.Ext}}"

Acceptance Criteria

  • Add LogConfig struct or option function for NewLog
  • Support template string in rotation naming
  • Default template preserves current behavior ({{.Base}}.{{.Seq}}{{.Ext}})
  • Document template variables in docs/rotation.md
  • Add tests for custom naming patterns

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions