{"id":24108201,"url":"https://github.com/trviph/lorekeeper","last_synced_at":"2025-10-30T04:03:23.521Z","repository":{"id":271544400,"uuid":"913337381","full_name":"trviph/lorekeeper","owner":"trviph","description":"Lorekeeper is a Go package that handles log rotation.","archived":false,"fork":false,"pushed_at":"2025-01-16T19:13:46.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T19:32:33.828Z","etag":null,"topics":["go","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trviph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-01-07T13:45:24.000Z","updated_at":"2025-01-16T19:32:19.000Z","dependencies_parsed_at":"2025-01-10T05:50:12.694Z","dependency_job_id":null,"html_url":"https://github.com/trviph/lorekeeper","commit_stats":null,"previous_names":["trviph/lorekeeper"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trviph%2Florekeeper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trviph%2Florekeeper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trviph%2Florekeeper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trviph%2Florekeeper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trviph","download_url":"https://codeload.github.com/trviph/lorekeeper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241090605,"owners_count":19907983,"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","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":["go","golang","log-rotation","logging"],"created_at":"2025-01-10T23:26:20.869Z","updated_at":"2025-10-30T04:03:23.237Z","avatar_url":"https://github.com/trviph.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lorekeeper\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/trviph/lorekeeper.svg)](https://pkg.go.dev/github.com/trviph/lorekeeper) [![CI](https://github.com/trviph/lorekeeper/actions/workflows/ci.yaml/badge.svg)](https://github.com/trviph/lorekeeper/actions/workflows/ci.yaml) [![codecov](https://codecov.io/gh/trviph/lorekeeper/graph/badge.svg?token=7DDZ8QNJHW)](https://codecov.io/gh/trviph/lorekeeper)\n\nLorekeeper is a Go package that manages log rotation. It should work nicely with the Go standard log package.\n\n**Note:** Lorekeeper is not a logging package, it only manages the log files, and should be use with other logging packages such as the standard [log](#with-standard-log-package), [slog](#with-standard-slog-package), or [logrus](#with-logrus).\n\n## Quick Guide\n\nFor more detailed information, please refer to the [GoDoc](https://pkg.go.dev/github.com/trviph/lorekeeper).\n\n### With Standard log Package\n\nPackage [log](https://pkg.go.dev/log) implements a simple logging package.\n\n```go\npackage main\n\nimport (\n    \"log\"\n    \"github.com/trviph/lorekeeper\"\n)\n\nfunc main() {\n    // Init lorekeeper, with the default configurations.\n    defaultKeeper, err := lorekeeper.NewKeeper()\n    if err != nil {\n        panic(err)\n    }\n    defer defaultKeeper.Close()\n\n    // Using lorekeeper with log\n    logger := log.New(keeper, \"[INFO] \", log.Lmsgprefix|log.LstdFlags)\n\n    // Starting using the logger\n    logger.Printf(\"that's it!\")\n}\n```\n\n### With Standard slog Package\n\nPackage [slog](https://pkg.go.dev/log/slog) provides structured logging, in which log records include a message, a severity level, and various other attributes expressed as key-value pairs.\n\n```go\npackage main\n\nimport (\n    \"log/slog\"\n    \"github.com/trviph/lorekeeper\"\n)\n\nfunc main() {\n    // Init lorekeeper, with the default configurations.\n    defaultKeeper, err := lorekeeper.NewKeeper()\n    if err != nil {\n        panic(err)\n    }\n    defer defaultKeeper.Close()\n\n    // Using lorekeeper with slog\n    logger := slog.New(slog.NewJSONHandler(keeper, nil))\n\n    // Starting using the logger\n    logger.Info(\"this is info\", \"msg\", \"testing\")\n    logger.Error(\"this is error\", \"msg\", \"testing\")\n}\n```\n\n### With Logrus\n\n[Logrus](https://github.com/sirupsen) is a structured, pluggable logging package for Go.  \n\n```go\npackage main\n\nimport (\n    log \"github.com/sirupsen/logrus\"\n    \"github.com/trviph/lorekeeper\"\n)\n\nfunc main() {\n    // Init lorekeeper, with the default configurations.\n    defaultKeeper, err := lorekeeper.NewKeeper()\n    if err != nil {\n        panic(err)\n    }\n    defer defaultKeeper.Close()\n\n    // Using lorekeeper with logrus\n    logger := log.New()\n    logger.SetLevel(log.InfoLevel)\n    logger.SetOutput(defaultKeeper)\n\n    // Starting using the logger\n    logger.Info(\"this will go into the log file\")\n    logger.Debug(\"this will not\")\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrviph%2Florekeeper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrviph%2Florekeeper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrviph%2Florekeeper/lists"}