{"id":14956060,"url":"https://github.com/ipfs/go-log","last_synced_at":"2025-04-14T00:59:51.879Z","repository":{"id":42466682,"uuid":"42484122","full_name":"ipfs/go-log","owner":"ipfs","description":"A logging library used by go-ipfs","archived":false,"fork":false,"pushed_at":"2025-03-29T08:32:14.000Z","size":410,"stargazers_count":62,"open_issues_count":13,"forks_count":49,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-04-14T00:59:39.954Z","etag":null,"topics":[],"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/ipfs.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}},"created_at":"2015-09-15T00:04:46.000Z","updated_at":"2025-04-04T04:14:48.000Z","dependencies_parsed_at":"2024-03-21T15:58:01.397Z","dependency_job_id":"62e97174-4631-4a75-9dac-ef51fd2f6626","html_url":"https://github.com/ipfs/go-log","commit_stats":{"total_commits":281,"total_committers":45,"mean_commits":"6.2444444444444445","dds":0.8220640569395018,"last_synced_commit":"d4825eba3c99b956004c578657a2df9ff08d55f8"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs%2Fgo-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs%2Fgo-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs%2Fgo-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipfs%2Fgo-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipfs","download_url":"https://codeload.github.com/ipfs/go-log/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804790,"owners_count":21164132,"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-09-24T13:12:15.386Z","updated_at":"2025-04-14T00:59:51.855Z","avatar_url":"https://github.com/ipfs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-log\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.io/)\n[![GoDoc](https://pkg.go.dev/badge/github.com/ipfs/go-log/v2.svg)](https://pkg.go.dev/github.com/ipfs/go-log/v2)\n\n\u003e The logging library used by go-ipfs\n\ngo-log wraps [zap](https://github.com/uber-go/zap) to provide a logging facade. go-log manages logging\ninstances and allows for their levels to be controlled individually.\n\n## Install\n\n```sh\ngo get github.com/ipfs/go-log\n```\n\n## Usage\n\nOnce the package is imported under the name `logging`, an instance of `EventLogger` can be created like so:\n\n```go\nvar log = logging.Logger(\"subsystem name\")\n```\n\nIt can then be used to emit log messages in plain printf-style messages at seven standard levels:\n\nLevels may be set for all loggers:\n\n```go\nlvl, err := logging.LevelFromString(\"error\")\nif err != nil {\n\tpanic(err)\n}\nlogging.SetAllLoggers(lvl)\n```\n\nor individually:\n\n```go\nerr := logging.SetLogLevel(\"net:pubsub\", \"info\")\nif err != nil {\n\tpanic(err)\n}\n```\n\nor by regular expression:\n\n```go\nerr := logging.SetLogLevelRegex(\"net:.*\", \"info\")\nif err != nil {\n\tpanic(err)\n}\n```\n\n### Environment Variables\n\nThis package can be configured through various environment variables.\n\n#### `GOLOG_LOG_LEVEL`\n\nSpecifies the log-level, both globally and on a per-subsystem basis.\n\nFor example, the following will set the global minimum log level to `error`, but reduce the minimum\nlog level for `subsystem1` to `info` and reduce the minimum log level for `subsystem2` to debug.\n\n```bash\nexport GOLOG_LOG_LEVEL=\"error,subsystem1=info,subsystem2=debug\"\n```\n\n`IPFS_LOGGING` is a deprecated alias for this environment variable.\n\n#### `GOLOG_FILE`\n\nSpecifies that logs should be written to the specified file. If this option is _not_ specified, logs are written to standard error.\n\n```bash\nexport GOLOG_FILE=\"/path/to/my/file.log\"\n```\n\n#### `GOLOG_OUTPUT`\n\nSpecifies where logging output should be written. Can take one or more of the following values, combined with `+`:\n\n- `stdout` -- write logs to standard out.\n- `stderr` -- write logs to standard error.\n- `file` -- write logs to the file specified by `GOLOG_FILE`\n\nFor example, if you want to log to both a file and standard error:\n\n```bash\nexport GOLOG_FILE=\"/path/to/my/file.log\"\nexport GOLOG_OUTPUT=\"stderr+file\"\n```\n\nSetting _only_ `GOLOG_FILE` will prevent logs from being written to standard error.\n\n#### `GOLOG_LOG_FMT`\n\nSpecifies the log message format. It supports the following values:\n\n- `color` -- human readable, colorized (ANSI) output\n- `nocolor` -- human readable, plain-text output.\n- `json` -- structured JSON.\n\nFor example, to log structured JSON (for easier parsing):\n\n```bash\nexport GOLOG_LOG_FMT=\"json\"\n```\n\nThe logging format defaults to `color` when the output is a terminal, and `nocolor` otherwise.\n\n`IPFS_LOGGING_FMT` is a deprecated alias for this environment variable.\n\n#### `GOLOG_LOG_LABELS`\n\nSpecifies a set of labels that should be added to all log messages as comma-separated key-value\npairs. For example, the following add `{\"app\": \"example_app\", \"dc\": \"sjc-1\"}` to every log entry.\n\n```bash\nexport GOLOG_LOG_LABELS=\"app=example_app,dc=sjc-1\"\n```\n\n## Contribute\n\nFeel free to join in. All welcome. Open an [issue](https://github.com/ipfs/go-log/issues)!\n\nThis repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n### Want to hack on IPFS?\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipfs%2Fgo-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipfs%2Fgo-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipfs%2Fgo-log/lists"}