{"id":29108771,"url":"https://github.com/brunotm/log","last_synced_at":"2025-10-23T19:57:24.265Z","repository":{"id":144202042,"uuid":"168429981","full_name":"brunotm/log","owner":"brunotm","description":" A simple, leveled, fast, zero allocation, json structured logging package for Go. Designed to make logging on the hot path dirt cheap, dependency free and my life easier.","archived":false,"fork":false,"pushed_at":"2022-03-14T17:40:23.000Z","size":45,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-29T06:43:24.733Z","etag":null,"topics":["golang","logging"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"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/brunotm.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,"zenodo":null}},"created_at":"2019-01-30T23:13:27.000Z","updated_at":"2022-03-14T17:40:27.000Z","dependencies_parsed_at":"2023-06-18T05:15:12.212Z","dependency_job_id":null,"html_url":"https://github.com/brunotm/log","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/brunotm/log","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunotm%2Flog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunotm%2Flog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunotm%2Flog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunotm%2Flog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brunotm","download_url":"https://codeload.github.com/brunotm/log/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brunotm%2Flog/sbom","scorecard":{"id":255512,"data":{"date":"2025-08-11","repo":{"name":"github.com/brunotm/log","commit":"a953baf36cb5efee2dc858e10fc64f39467013c7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T09:37:19.938Z","repository_id":144202042,"created_at":"2025-08-17T09:37:19.938Z","updated_at":"2025-08-17T09:37:19.938Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280684034,"owners_count":26372971,"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-10-23T02:00:06.710Z","response_time":142,"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","logging"],"created_at":"2025-06-29T06:37:37.068Z","updated_at":"2025-10-23T19:57:24.260Z","avatar_url":"https://github.com/brunotm.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# log\n\n[![Build Status](https://travis-ci.org/brunotm/log.svg?branch=master)](https://travis-ci.org/brunotm/log)\n[![Go Report Card](https://goreportcard.com/badge/github.com/brunotm/log)](https://goreportcard.com/report/github.com/brunotm/log)\n[![GoDoc](https://godoc.org/github.com/brunotm/log?status.svg)](https://godoc.org/github.com/brunotm/log)\n\nA simple, leveled, fast, zero allocation, structured logging package for Go.\nDesigned to make logging on the hot path dirt cheap, dependency free and my life easier.\n\nA simpler textual key/value format is also available by setting `Config.Text to true`\n\nBy default log entries with the same level and message within each second, will be sampled to cap CPU and I/O load under high logging activity.\nThis behavior can be disabled by setting `Config.EnableSampling to false`\n\n## Usage\n\n### Default package logger\n\n```go\nimport (\n    \"github.com/brunotm/log\"\n)\n\nfunc main() {\n    // Simple logging\n    log.Info(\"info message\").String(\"key\", \"value\").Write()\n    // Text format:\n    // time=\"2021-03-25T13:32:50.391Z\" level=\"info\" caller=\"_local/main.go:26\" app=\"app1\" message=\"info message\" key=\"value\"\n    // JSON format:\n    // {\"time\":\"2021-03-25T13:33:20.547Z\", \"level\":\"info\", \"caller\":\"_local/main.go:26\", \"app\":\"app1\", \"message\":\"info message\", \"key\":\"value\"}\n}\n```\n\n### New customized logger\n\n```go\npackage main\n\nimport (\n    \"os\"\n\n    \"github.com/brunotm/log\"\n)\n\nfunc main() {\n    config := DefaultConfig\n    config.Level = DEBUG\n    config.Format = FormatText // Enable text logging\n\n    // New logger with added context\n    l := New(os.Stdout, config).\n        With(func(e Entry) {\n            e.String(\"app\", \"app1\")\n        })\n\n    // Simple logging\n    l.Info(\"info message\").String(\"key\", \"value\").Write()\n    // Text format:\n    // time=\"2021-03-25T13:32:50.391Z\" level=\"info\" caller=\"_local/main.go:26\" app=\"app1\" message=\"info message\" key=\"value\"\n    // JSON format:\n    // {\"time\":\"2021-03-25T13:33:20.547Z\", \"level\":\"info\", \"caller\":\"_local/main.go:26\", \"app\":\"app1\", \"message\":\"info message\", \"key\":\"value\"}\n\n    l.Warn(\"warn message\").Bool(\"flag\", false).Write()\n    // Text format:\n    // time=\"2021-03-25T13:32:50.391Z\" level=\"warn\" caller=\"_local/main.go:29\" app=\"app1\" message=\"warn message\" flag=false\n    // JSON format:\n    // {\"time\":\"2021-03-25T13:33:20.547Z\", \"level\":\"warn\", \"caller\":\"_local/main.go:29\", \"app\":\"app1\", \"message\":\"warn message\", \"flag\":false}\n\n    l.Error(\"caught an error\").String(\"error\", \"request error\").Write()\n    // Text format:\n    // time=\"2021-03-25T13:32:50.391Z\" level=\"error\" caller=\"_local/main.go:32\" app=\"app1\" message=\"caught an error\" error=\"request error\"\n    // JSON format:\n    // {\"time\":\"2021-03-25T13:33:20.547Z\", \"level\":\"error\", \"caller\":\"_local/main.go:32\", \"app\":\"app1\", \"message\":\"caught an error\", \"error\":\"request error\"}\n\n    l.Fatal(\"caught an unrecoverable error\").Error(\"error\", errors.New(\"some error\")).Write()\n    // Text format:\n    // time=\"2021-03-25T13:32:50.391Z\" level=\"fatal\" caller=\"_local/main.go:35\" app=\"app1\" message=\"caught an unrecoverable error\" error=\"some error\"\n    // JSON format:\n    // {\"time\":\"2021-03-25T13:33:20.547Z\", \"level\":\"fatal\", \"caller\":\"_local/main.go:35\", \"app\":\"app1\", \"message\":\"caught an unrecoverable error\", \"error\":\"some error\"}\n}\n```\n\n## Performance on a 2,3 GHz Intel Core i5, 2017 13-inch Macbook Pro\n\nMessage: `{\"level\":\"info\",\"time\":\"2019-01-30T20:54:07.029Z\",\"message\":\"informational message\",\"string value\":\"text\",\"int value\":8,\"float\":722727272.0099,\"int\":8,\"float value\":722727272.0099}`\n\n```bash\npkg: github.com/brunotm/log\nBenchmarkLogNoSampling-8         1672147               704 ns/op               0 B/op          0 allocs/op\nBenchmarkLogWithSampling-8      10266382               111 ns/op               0 B/op          0 allocs/op\nBenchmarkLogNoLevel-8           340966922                3.46 ns/op            0 B/op          0 allocs/op\n```\n\n## Contact\n\nBruno Moura [brunotm@gmail.com](mailto:brunotm@gmail.com)\n\n## License\n\nlog source code is available under the Apache Version 2.0 [License](/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunotm%2Flog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrunotm%2Flog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrunotm%2Flog/lists"}