{"id":26737114,"url":"https://github.com/tymonx/go-logger","last_synced_at":"2025-03-28T02:37:58.639Z","repository":{"id":64306281,"uuid":"267654839","full_name":"tymonx/go-logger","owner":"tymonx","description":"Lightweight, fast and powerful logger implementation in Go. It is only a read-only project mirror. Active development is maintained at the GitLab.","archived":false,"fork":false,"pushed_at":"2020-07-29T20:23:23.000Z","size":105,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T09:08:01.480Z","etag":null,"topics":["go","golang","log","logger","logging","logging-library","logs","syslog"],"latest_commit_sha":null,"homepage":"https://gitlab.com/tymonx/go-logger","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tymonx.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}},"created_at":"2020-05-28T17:36:29.000Z","updated_at":"2020-07-29T20:21:24.000Z","dependencies_parsed_at":"2022-12-06T08:22:30.874Z","dependency_job_id":null,"html_url":"https://github.com/tymonx/go-logger","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tymonx%2Fgo-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tymonx%2Fgo-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tymonx%2Fgo-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tymonx%2Fgo-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tymonx","download_url":"https://codeload.github.com/tymonx/go-logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245958965,"owners_count":20700539,"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","logger","logging","logging-library","logs","syslog"],"created_at":"2025-03-28T02:37:58.085Z","updated_at":"2025-03-28T02:37:58.633Z","avatar_url":"https://github.com/tymonx.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Logger\n\nLightweight, fast and powerful logger implementation in Go.\n\n## Features\n\n*   All log formatting and I/O operations are offloaded to separate worker thread\n*   All calls to log methods are lightweight and consumes very little CPU resources\n*   It can simultaneously log message to different log handlers\n*   Various customizable built-in log handlers `Stdout`, `Stderr`, `File`, `Stream`, `Buffer` and `Syslog`\n*   Various log methods `Trace`, `Debug`, `Info`, `Notice`, `Warning`, `Error`, `Critical`, `Alert`, `Fatal` and `Panic`\n*   Flexible log message formatter with some predefined named placeholders\n*   Use new created logger instance or use the global one as `logger.*`\n*   Supporting the [NDJSON](http://ndjson.org) output format\n*   Supporting automatic placeholders for log arguments with `{p}`\n*   Supporting positional placeholders for log arguments with `{pN}`\n*   Supporting named placeholders for log arguments with `{name}`, `{p.name}` or `{pN.name}`\n*   Supporting object placeholders for log arguments with `{.Field}`, `{p.Field}` or `{pN.Field}`\n*   Supporting custom placeholder identification (default is `p`)\n*   Supporting custom stream handlers\n*   Supporting custom log handlers\n*   Supporting custom log formatters\n*   Supporting custom log date formats\n*   Supporting custom log message formats\n*   Supporting custom log ID generators\n*   Supporting exporting log records to JSON output\n*   No external third party dependencies\n\n## Install\n\n```plaintext\ngo get -u gitlab.com/tymonx/go-logger\n```\n\n## Example\n\n```go\npackage main\n\nimport (\n\t\"gitlab.com/tymonx/go-logger/logger\"\n)\n\nfunc main() {\n\t// The close method is needed because all log methods are offloaded to\n\t// separate worker thread. The Close() function guarantees that all log\n\t// messages will be flushed out and all log handlers will be properly closed\n\tdefer logger.Close()\n\n\tlogger.Info(\"Hello from logger!\")\n\tlogger.Info(\"Automatic placeholders {p} {p} {p}\", 1, 2, 3)\n\tlogger.Info(\"Positional placeholders {p2} {p1} {p0}\", 1, 2, 3)\n\n\tlogger.Info(\"Named placeholders {z} {y} {x}\", logger.Named{\n\t\t\"x\": 1,\n\t\t\"y\": 2,\n\t\t\"z\": 3,\n\t})\n\n\tlogger.Info(\"Object placeholders {.Z} {.Y} {.X}\", struct {\n\t\tX, Y, Z int\n\t}{\n\t\tX: 1,\n\t\tY: 2,\n\t\tZ: 3,\n\t})\n}\n```\n\nExample output:\n\n```plaintext\n2020-05-13 12:37:22,536 - Info     - main.go:28:main.main(): Hello from logger!\n2020-05-13 12:37:22,536 - Info     - main.go:29:main.main(): Automatic placeholders 1 2 3\n2020-05-13 12:37:22,536 - Info     - main.go:30:main.main(): Positional placeholders 3 2 1\n2020-05-13 12:37:22,536 - Info     - main.go:32:main.main(): Named placeholders 3 2 1\n2020-05-13 12:37:22,536 - Info     - main.go:38:main.main(): Object placeholders 3 2 1\n```\n\n## Documentation\n\nGo logger [documentation](https://tymonx.gitlab.io/go-logger/doc/pkg/gitlab.com/tymonx/go-logger/logger/).\n\n## Development\n\nAll tools needed for developing, formatting, building, linting, testing and\ndocumenting this project are available out-of-box from the Docker image as\npart of the [tymonx/docker-go](https://gitlab.com/tymonx/docker-go) project.\n\nRun the `docker-run` script without any arguments to work in Docker\ncontainer:\n\n```plaintext\nscripts/docker-run\n```\n\nUse the `go-format` script to automatically reformat Go source files:\n\n```plaintext\nscripts/go-format\n```\n\nUse the `go-lint` script to run various Go linters on Go source files with\nenabled colorization:\n\n```plaintext\nscripts/go-lint\n```\n\nUse the `go-build` script to build Go source files. Equivalent to\nthe `go build ./...` execution:\n\n```plaintext\nscripts/go-build\n```\n\nUse the `go-test` script to run tests and validate coverage result with\nenabled colorization:\n\n```plaintext\nscripts/go-test\n```\n\nUse the `go-test-no-cover` script to run tests without coverage:\n\n```plaintext\nscripts/go-test-no-cover\n```\n\nTo run only a single test pass the `-run` option with test name:\n\n```plaintext\nscripts/go-test -run \u003cTestName\u003e ./...\n```\n\nAll above scripts accept standard Go paths as additional arguments like\n`./`, `./...`, `\u003cpackage-name\u003e` and so on.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftymonx%2Fgo-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftymonx%2Fgo-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftymonx%2Fgo-logger/lists"}