{"id":13601106,"url":"https://github.com/op/go-logging","last_synced_at":"2025-05-13T18:13:00.531Z","repository":{"id":7815389,"uuid":"9186188","full_name":"op/go-logging","owner":"op","description":"Golang logging library","archived":false,"fork":false,"pushed_at":"2023-12-13T20:47:18.000Z","size":149,"stargazers_count":1798,"open_issues_count":61,"forks_count":273,"subscribers_count":59,"default_branch":"master","last_synced_at":"2025-05-03T01:51:17.027Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/op.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2013-04-03T03:45:10.000Z","updated_at":"2025-03-05T08:36:40.000Z","dependencies_parsed_at":"2024-01-13T15:37:25.638Z","dependency_job_id":"82bf1012-b853-4280-9b9f-211bce4ab8fb","html_url":"https://github.com/op/go-logging","commit_stats":{"total_commits":76,"total_committers":21,"mean_commits":3.619047619047619,"dds":0.4605263157894737,"last_synced_commit":"970db520ece77730c7e4724c61121037378659d9"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/op%2Fgo-logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/op%2Fgo-logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/op%2Fgo-logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/op%2Fgo-logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/op","download_url":"https://codeload.github.com/op/go-logging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254000883,"owners_count":21997443,"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":[],"created_at":"2024-08-01T18:00:55.844Z","updated_at":"2025-05-13T18:13:00.509Z","avatar_url":"https://github.com/op.png","language":"Go","funding_links":[],"categories":["Go"],"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**_NOTE:_** backwards compatibility promise have been dropped for master. Please\nvendor this package or use `gopkg.in/op/go-logging.v1` for previous version. See\n[changelog](CHANGELOG.md) for details.\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.Debugf(\"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    $GOPATH/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/exp/wslog) -- exposes log messages through a WebSocket.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fop%2Fgo-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fop%2Fgo-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fop%2Fgo-logging/lists"}