{"id":18331475,"url":"https://github.com/antonfisher/nested-logrus-formatter","last_synced_at":"2025-04-04T18:06:46.358Z","repository":{"id":34836302,"uuid":"153236046","full_name":"antonfisher/nested-logrus-formatter","owner":"antonfisher","description":"Formatter for https://github.com/sirupsen/logrus","archived":false,"fork":false,"pushed_at":"2022-10-13T11:12:56.000Z","size":227,"stargazers_count":160,"open_issues_count":5,"forks_count":31,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T17:07:03.355Z","etag":null,"topics":["formatter","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antonfisher.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":"2018-10-16T06:47:11.000Z","updated_at":"2025-02-27T08:56:43.000Z","dependencies_parsed_at":"2023-01-15T09:27:55.160Z","dependency_job_id":null,"html_url":"https://github.com/antonfisher/nested-logrus-formatter","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonfisher%2Fnested-logrus-formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonfisher%2Fnested-logrus-formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonfisher%2Fnested-logrus-formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonfisher%2Fnested-logrus-formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonfisher","download_url":"https://codeload.github.com/antonfisher/nested-logrus-formatter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226213,"owners_count":20904465,"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":["formatter","golang","logging"],"created_at":"2024-11-05T19:32:31.664Z","updated_at":"2025-04-04T18:06:46.336Z","avatar_url":"https://github.com/antonfisher.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# nested-logrus-formatter\n\n[![Build Status](https://travis-ci.org/antonfisher/nested-logrus-formatter.svg?branch=master)](https://travis-ci.org/antonfisher/nested-logrus-formatter)\n[![Go Report Card](https://goreportcard.com/badge/github.com/antonfisher/nested-logrus-formatter)](https://goreportcard.com/report/github.com/antonfisher/nested-logrus-formatter)\n[![GoDoc](https://godoc.org/github.com/antonfisher/nested-logrus-formatter?status.svg)](https://godoc.org/github.com/antonfisher/nested-logrus-formatter)\n\nHuman-readable log formatter, converts _logrus_ fields to a nested structure:\n\n![Screenshot](https://raw.githubusercontent.com/antonfisher/nested-logrus-formatter/docs/images/demo.png)\n\n## Configuration:\n\n```go\ntype Formatter struct {\n\t// FieldsOrder - default: fields sorted alphabetically\n\tFieldsOrder []string\n\n\t// TimestampFormat - default: time.StampMilli = \"Jan _2 15:04:05.000\"\n\tTimestampFormat string\n\n\t// HideKeys - show [fieldValue] instead of [fieldKey:fieldValue]\n\tHideKeys bool\n\n\t// NoColors - disable colors\n\tNoColors bool\n\n\t// NoFieldsColors - apply colors only to the level, default is level + fields\n\tNoFieldsColors bool\n\n\t// NoFieldsSpace - no space between fields\n\tNoFieldsSpace bool\n\n\t// ShowFullLevel - show a full level [WARNING] instead of [WARN]\n\tShowFullLevel bool\n\n\t// NoUppercaseLevel - no upper case for level value\n\tNoUppercaseLevel bool\n\n\t// TrimMessages - trim whitespaces on messages\n\tTrimMessages bool\n\n\t// CallerFirst - print caller info first\n\tCallerFirst bool\n\n\t// CustomCallerFormatter - set custom formatter for caller info\n\tCustomCallerFormatter func(*runtime.Frame) string\n}\n```\n\n## Usage\n\n```go\nimport (\n\tnested \"github.com/antonfisher/nested-logrus-formatter\"\n\t\"github.com/sirupsen/logrus\"\n)\n\nlog := logrus.New()\nlog.SetFormatter(\u0026nested.Formatter{\n\tHideKeys:    true,\n\tFieldsOrder: []string{\"component\", \"category\"},\n})\n\nlog.Info(\"just info message\")\n// Output: Jan _2 15:04:05.000 [INFO] just info message\n\nlog.WithField(\"component\", \"rest\").Warn(\"warn message\")\n// Output: Jan _2 15:04:05.000 [WARN] [rest] warn message\n```\n\nSee more examples in the [tests](./tests/formatter_test.go) file.\n\n## Development\n\n```bash\n# run tests:\nmake test\n\n# run demo:\nmake demo\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonfisher%2Fnested-logrus-formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonfisher%2Fnested-logrus-formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonfisher%2Fnested-logrus-formatter/lists"}