{"id":30664577,"url":"https://github.com/colecrouter/log-manager","last_synced_at":"2025-08-31T19:03:57.152Z","repository":{"id":57696772,"uuid":"493456572","full_name":"colecrouter/log-manager","owner":"colecrouter","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-12T01:09:25.000Z","size":2625,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-22T02:15:36.882Z","etag":null,"topics":["golang","log-rotation","logging"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/colecrouter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-18T00:36:38.000Z","updated_at":"2022-05-18T01:00:27.000Z","dependencies_parsed_at":"2024-06-20T00:39:07.511Z","dependency_job_id":"92c328b1-8369-4912-bf3c-cfd1b6607940","html_url":"https://github.com/colecrouter/log-manager","commit_stats":null,"previous_names":["colecrouter/log-manager","mexican-man/log-manager"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/colecrouter/log-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colecrouter%2Flog-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colecrouter%2Flog-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colecrouter%2Flog-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colecrouter%2Flog-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/colecrouter","download_url":"https://codeload.github.com/colecrouter/log-manager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colecrouter%2Flog-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273025827,"owners_count":25032842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","log-rotation","logging"],"created_at":"2025-08-31T19:03:56.448Z","updated_at":"2025-08-31T19:03:57.146Z","avatar_url":"https://github.com/colecrouter.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Log-Manager\n```bash\ngo get github.com/Mexican-Man/log-manager\n```\n\nThere are lots of good log rotators out there, but I couldn't find one that gave me the granularity/number of features that I needed. So, I've compiled features from other log rotating packages into this one. If you think it's missing a feature, please open an issue or PR.\n\n## How to Use\n```go\nimport (\n    lm \"github.com/Mexican-Man/log-manager\"\n)\n\nmanager := lm.NewLogManager(lm.LogManagerOptions{\n    Dir:              \"/path/to/logs\",\n    RotationInterval: time.Hour * 24,\n})\n\nlog.SetOutput(manager)\n```\n\n## Options\n- *`Dir` — Directory to store logs in\n- *`RotationInterval` — How often to rotate logs (0 disables it)\n- `FilenameFormat` — Template string using [text/template](https://pkg.go.dev/text/template) (more info below)\n- `MaxFileSize` — How large a file can get before its rotated (0 for no limit)\n- `GZIP` — GZIP old logs\n- `LatestDotLog` — Keeps a symlink called `latest` that points to the latest log\n\n## More Details\n### `Filenameformat`\nHere's the templated struct format:\n```go\ntype LogTemplate struct {\n\tTime      time.Time\n\tIteration uint\n}\n```\n\nWhen rotating, `Interation` will increase if another log with the same name already exists. If increasing the iteration does not solve the issue, it will throw an error, and continue writing to the old log.\n\nHere's the default, if not defined in `LogManagerOptions{}`:\n```go\n{{ .Time.Format \"2006-01-02\" }}_{{ .Iteration }}.log\n```\nThis will print create logs like this:\n- 2022-05-17_0.log\n- 2022-05-17_1.log\n- 2022-05-18_0.log\n\nHere's another example:\n```go\n{{ .Time.Format \"2006-01-02\" }}{{ if .Iteration }}_{{ .Iteration }}{{ end }}.log\n```\nThis will print create logs like this:\n- 2022-05-17.log\n- 2022-05-17_1.log\n- 2022-05-18.log\n\n\u003e Note that the date format is the [Go's standard date formatting](https://pkg.go.dev/time#Time.Format).\n\n### Scheduled Rotation\nYou can set `RotationInterval` to indicate when your logs should rotate. For example, a `RotationInterval` of\n```go\ntime.Hour * 24\n```\nwould ensure that logs are rotated everyday, at midnight. A `RotationInterval` of\n```go\ntime.Hour * 12\n```\nwould ensure that logs are rotated everyday, at midnight and noon.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolecrouter%2Flog-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcolecrouter%2Flog-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolecrouter%2Flog-manager/lists"}