{"id":13413283,"url":"https://github.com/amoghe/distillog","last_synced_at":"2026-01-21T23:12:20.917Z","repository":{"id":57485001,"uuid":"44119979","full_name":"amoghe/distillog","owner":"amoghe","description":"Logging, distilled","archived":false,"fork":false,"pushed_at":"2018-07-26T23:35:13.000Z","size":21,"stargazers_count":31,"open_issues_count":1,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-07-31T20:52:12.559Z","etag":null,"topics":["golang","logger","logger-interface","logging"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amoghe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-12T16:32:21.000Z","updated_at":"2024-04-17T07:58:33.000Z","dependencies_parsed_at":"2022-08-26T11:10:57.412Z","dependency_job_id":null,"html_url":"https://github.com/amoghe/distillog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amoghe/distillog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoghe%2Fdistillog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoghe%2Fdistillog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoghe%2Fdistillog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoghe%2Fdistillog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amoghe","download_url":"https://codeload.github.com/amoghe/distillog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoghe%2Fdistillog/sbom","scorecard":{"id":190216,"data":{"date":"2025-08-11","repo":{"name":"github.com/amoghe/distillog","commit":"ae382b35b7179be96f516c07ae0e54b7723a4822"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"Code-Review","score":0,"reason":"Found 1/26 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":"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":"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":"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":"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":"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"}},{"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.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt: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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T20:31:30.857Z","repository_id":57485001,"created_at":"2025-08-16T20:31:30.857Z","updated_at":"2025-08-16T20:31:30.857Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28646906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T21:29:11.980Z","status":"ssl_error","status_checked_at":"2026-01-21T21:24:31.872Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","logger","logger-interface","logging"],"created_at":"2024-07-30T20:01:36.794Z","updated_at":"2026-01-21T23:12:20.898Z","avatar_url":"https://github.com/amoghe.png","language":"Go","funding_links":[],"categories":["Logging","Relational Databases","日志","日志记录","\u003cspan id=\"日志-logging\"\u003e日志 Logging\u003c/span\u003e","Logging 日志库"],"sub_categories":["Search and Analytic Databases","交流","Advanced Console UIs","检索及分析资料库","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","SQL 查询语句构建库"],"readme":"[![Build Status](https://travis-ci.org/amoghe/distillog.svg)](https://travis-ci.org/amoghe/distillog)\n[![Documentation](https://godoc.org/github.com/amoghe/distillog?status.svg)](http://godoc.org/github.com/amoghe/distillog)\n[![Go Report Card](https://goreportcard.com/badge/github.com/amoghe/distillog)](https://goreportcard.com/report/github.com/amoghe/distillog)\n\n# What is `distillog`?\n\n`distillog` aims to offer a minimalistic logging interface that also supports\nlog levels. It takes the `stdlib` API and only slightly enhances it. Hence, you\ncould think of it as levelled logging, _distilled_.\n\n# Yet _another_ logging library for go(lang)?\n\n\u003e Logging libraries are like opinions, everyone seems to have one -- Anon(?)\n\nMost other logging libraries do either __too little__ ([stdlib][0])\nor __too much__ ([glog][1]).\n\nAs with most other libraries, this one is opinionated. In terms of functionality\nit exposes, it attempts to sit somewhere between the stdlib and the majority of\nother logging libraries available (but leans mostly towards the spartan side\nof stdlib).\n\n## The stdlib does _too little_, you say?\n\nJust a smidge.\n\nPresenting varying levels of verbosity (or severity) are an important part of\nwhat makes a program more usable or debuggable. For example, `debug` or `info`\nlevel messages may be useful to the developers during the development cycle.\nThese messages may be dropped or suppressed in production since they are not\nuseful to everyone. Similarly `warning` messages may be emitted when a error has\nbeen gracefully handled but the program would like to notify its human overlords\nof some impending doom.\n\nIn most cases, some downstream entity \"knows\" how to filter the messages and\nkeep those that are relevant to the environment. As evidence of this, most\nother languages have log libraries that support levels. Similarly some programs\noffer varying verbosity levels (e.g. `-v`, `-vv` etc). The golang stdlib takes\na much more spartan approach (exposing only `Println` and friends) so using it\nin programs to emit messages of varying interest/levels can get tedious (manual\nprefixes, anyone?). This is where `distillog` steps in. It aims to slightly\nimprove on this minimalstic logging interface. __Slightly__.\n\n## Other libraries do _too much_, you say?\n\nEver used `log.Panicf` or `log.Fatalf`? Exiting your program is *not* something\nyour log library should be doing! Similarly, other libraries offer options for\nmaintaining old log files and rotating them. Your logging library shouldn't need\nto care about this. Whatever facility (other libraries call this a \"backend\")\nmessages are sent to should determine how old messages are handled. `distillog`\nprefers that you use `lumberjack` (or an equivalent WriteCloser) depending on\nwhere you choose to persist the messages.\n\n\u003e But log file rotation is absolutely necessary!\n\nAgreed, and someone's gotta do it, but it need not be your logging library!\n\nYou can use `distillog` along with a [lumberjack][2] \"backend\". It provides an\n`io.WriteCloser` which performs all the magic you need. Initialize a logger\nusing `distillog.NewStream`, pass it an instance of the `io.WriteCloser`\nthat lumberjack returns, _et voila_, you have a logger that does what you need.\n\n## And how is `distillog` different?\n\n`distillog` aims to offer a only slightly richer interface than the stdlib.\n\nTo this end, it restricts itself to:\n- presenting a minimal interface so that you can emit levelled log messages\n- providing logger implementations for logging to the most common backends\n\t- streams - e.g. stderr/stdout \n\t- files - anything via `io.WriteCloser` (via `lumberjack`)\n\t- syslog\n- avoid taking on any non-essential responsibilities (colors, _ahem_)\n- expose a logger interface, instead of an implementation\n\n## Expose an interface? Why?\n\nBy exposing an interface you can write programs that use levelled log messages,\nbut switch between logging to various facilities by simply instantiating the\nappropriate logger as determined by the caller (Your program can offer a\ncommand-line switch like so - `--log-to=[syslog,stderr,\u003cfile\u003e]` and the simply\ninstantiate the appropriate logger).\n\n# Usage/examples:\n\nAs seen in the [godoc](https://godoc.org/github.com/amoghe/distillog#Logger),\nthe interface is limited to:\n\n```golang\ntype Logger interface {\n\tDebugf(format string, v ...interface{})\n\tDebugln(v ...interface{})\n\n\tInfof(format string, v ...interface{})\n\tInfoln(v ...interface{})\n\n\tWarningf(format string, v ...interface{})\n\tWarningln(v ...interface{})\n\n\tErrorf(format string, v ...interface{})\n\tErrorln(v ...interface{})\n\n\tClose() error\n}\n```\n\nLog to stdout, or stderr using a logger instantiated like so:\n\n```golang\noutLogger := distillog.NewStdoutLogger(\"test\")\n\nerrLogger := distillog.NewStderrLogger(\"test\")\n\nsysLogger := distillog.NewSyslogLogger(\"test\")\n```\n\nAlternatively, you can use the package for your logging needs:\n\n```golang\nimport log \"github.com/amoghe/distillog\"\n\n// ... later ...\n\nlog.Infoln(\"Starting program\")\nlog.Debugln(\"initializing the frobnicator\")\nlog.Warningln(\"frobnicator failure detected, proceeding anyways...\")\nlog.Infoln(\"Exiting\")\n```\n\nIf you have a file you wish to log to, you should open the file and instantiate\na logger using the file handle, like so:\n\n```golang\nif fileHandle, err := ioutil.Tempfile(\"/tmp\", \"distillog-test\"); err == nil {\n        fileLogger := distillog.NewStreamLogger(\"test\", fileHandle)\n}\n```\n\nIf you need a logger that manages the rotation of its files, use `lumberjack`,\nlike so:\n\n```golang\nlumberjackHandle := \u0026lumberjack.Logger{\n        Filename:   \"/var/log/myapp/foo.log\",\n        MaxSize:    500,                       // megabytes\n        MaxBackups: 3,\n        MaxAge:     28,                        // days\n}\n\nlogger := distillog.NewStreamLogger(\"tag\", lumberjackHandle)\n\n// Alternatively, configure the pkg level logger to emit here\n\ndistillog.SetOutput(lumberjackHandle)\n```\n\nOnce instantiated, you can log messages, like so:\n\n```golang\nvar := \"World!\"\nmyLogger.Infof(\"Hello, %s\", var)\nmyLogger.Warningln(\"Goodbye, cruel world!\")\n\n```\n\n# Contributing\n\n1. Create an issue, describe the bugfix/feature you wish to implement.\n2. Fork the repository\n3. Create your feature branch (`git checkout -b my-new-feature`)\n4. Commit your changes (`git commit -am 'Add some feature'`)\n5. Push to the branch (`git push origin my-new-feature`)\n6. Create a new Pull Request\n\n# License\n\nSee [LICENSE.txt](LICENSE.txt)\n\n[0]: https://golang.org/pkg/log/\n[1]: https://github.com/golang/glog\n[2]: https://github.com/natefinch/lumberjack\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famoghe%2Fdistillog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famoghe%2Fdistillog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famoghe%2Fdistillog/lists"}