{"id":37190655,"url":"https://github.com/alecthomas/go-logging","last_synced_at":"2026-01-14T22:01:13.738Z","repository":{"id":66600200,"uuid":"21223019","full_name":"alecthomas/go-logging","owner":"alecthomas","description":"Golang logging library","archived":false,"fork":true,"pushed_at":"2015-06-02T07:27:02.000Z","size":256,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-14T12:48:53.586Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"op/go-logging","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alecthomas.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":"2014-06-26T00:33:13.000Z","updated_at":"2014-06-26T00:31:25.000Z","dependencies_parsed_at":"2023-02-20T16:32:11.049Z","dependency_job_id":null,"html_url":"https://github.com/alecthomas/go-logging","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alecthomas/go-logging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fgo-logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fgo-logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fgo-logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fgo-logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alecthomas","download_url":"https://codeload.github.com/alecthomas/go-logging/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecthomas%2Fgo-logging/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28436268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T21:32:52.117Z","status":"ssl_error","status_checked_at":"2026-01-14T21:32:33.442Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":[],"created_at":"2026-01-14T22:01:12.086Z","updated_at":"2026-01-14T22:01:13.664Z","avatar_url":"https://github.com/alecthomas.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Golang logging library\n\n[![godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/op/go-logging) [![build](https://img.shields.io/travis/op/go-logging.svg?style=flat)](https://travis-ci.org/op/go-logging)\n\nPackage logging implements a logging infrastructure for Go. Its output format\nis customizable and supports different logging backends like syslog, file and\nmemory. Multiple backends can be utilized with different log levels per backend\nand logger.\n\n## Example\n\nLet's have a look at an [example](examples/example.go) which demonstrates most\nof the features found in this library.\n\n[![Example Output](examples/example.png)](examples/example.go)\n\n```go\npackage main\n\nimport (\n\t\"os\"\n\n\t\"github.com/op/go-logging\"\n)\n\nvar log = logging.MustGetLogger(\"example\")\n\n// Example format string. Everything except the message has a custom color\n// which is dependent on the log level. Many fields have a custom output\n// formatting too, eg. the time returns the hour down to the milli second.\nvar format = logging.MustStringFormatter(\n\t\"%{color}%{time:15:04:05.000} %{shortfunc} ▶ %{level:.4s} %{id:03x}%{color:reset} %{message}\",\n)\n\n// Password is just an example type implementing the Redactor interface. Any\n// time this is logged, the Redacted() function will be called.\ntype Password string\n\nfunc (p Password) Redacted() interface{} {\n\treturn logging.Redact(string(p))\n}\n\nfunc main() {\n\t// For demo purposes, create two backend for os.Stderr.\n\tbackend1 := logging.NewLogBackend(os.Stderr, \"\", 0)\n\tbackend2 := logging.NewLogBackend(os.Stderr, \"\", 0)\n\n\t// For messages written to backend2 we want to add some additional\n\t// information to the output, including the used log level and the name of\n\t// the function.\n\tbackend2Formatter := logging.NewBackendFormatter(backend2, format)\n\n\t// Only errors and more severe messages should be sent to backend1\n\tbackend1Leveled := logging.AddModuleLevel(backend1)\n\tbackend1Leveled.SetLevel(logging.ERROR, \"\")\n\n\t// Set the backends to be used.\n\tlogging.SetBackend(backend1Leveled, backend2Formatter)\n\n\tlog.Debug(\"debug %s\", Password(\"secret\"))\n\tlog.Info(\"info\")\n\tlog.Notice(\"notice\")\n\tlog.Warning(\"warning\")\n\tlog.Error(\"err\")\n\tlog.Critical(\"crit\")\n}\n```\n\n## Installing\n\n### Using *go get*\n\n    $ go get github.com/op/go-logging\n\nAfter this command *go-logging* is ready to use. Its source will be in:\n\n    $GOROOT/src/pkg/github.com/op/go-logging\n\nYou can use `go get -u` to update the package.\n\n## Documentation\n\nFor docs, see http://godoc.org/github.com/op/go-logging or run:\n\n    $ godoc github.com/op/go-logging\n\n## Additional resources\n\n* [wslog](https://godoc.org/github.com/cryptix/go/logging/wslog) -- exposes log messages through a WebSocket.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecthomas%2Fgo-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falecthomas%2Fgo-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecthomas%2Fgo-logging/lists"}