{"id":19681309,"url":"https://github.com/reconquest/cog","last_synced_at":"2025-06-27T23:36:11.072Z","repository":{"id":57494246,"uuid":"130837825","full_name":"reconquest/cog","owner":"reconquest","description":"Structured key-value logger without breaking order of fields.  :wrench:","archived":false,"fork":false,"pushed_at":"2024-08-30T11:35:10.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-29T04:43:16.667Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reconquest.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,"zenodo":null}},"created_at":"2018-04-24T10:35:54.000Z","updated_at":"2024-08-30T11:35:14.000Z","dependencies_parsed_at":"2024-06-19T17:41:44.451Z","dependency_job_id":"e6889e65-f342-4aef-9a3a-03194e9c706d","html_url":"https://github.com/reconquest/cog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/reconquest/cog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reconquest%2Fcog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reconquest%2Fcog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reconquest%2Fcog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reconquest%2Fcog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reconquest","download_url":"https://codeload.github.com/reconquest/cog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reconquest%2Fcog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262352129,"owners_count":23297642,"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-11-11T18:07:30.075Z","updated_at":"2025-06-27T23:36:11.050Z","avatar_url":"https://github.com/reconquest.png","language":"Go","readme":"# cog\n\n\u003cimg src=\"https://liquipedia.net/commons/images/7/71/Clockwerk_power_cog.jpg\" width=\"200px\" /\u003e\n\nPackage provides to structured log both for displaying it sanely in the stderr\nlogs as well as sending key-valued logs into any log storage such as ElasticSearch.\n\nTo setup basic stderr logging, use following snippet in your `main.go`:\n\n```go\nimport \"github.com/reconquest/cog\"\n\n// ...\n\nstderr := lorg.NewLog()\nstderr.SetIndentLines(true)\nstderr.SetFormat(\n    lorg.NewFormat(\"${time} ${level:[%s]:right:short} ${prefix}%s\"),\n)\n\nif args[\"--debug\"].(bool) {\n    stderr.SetLevel(lorg.LevelDebug)\n}\n\nlog = cog.NewLogger(stderr)\n\n// use like that\nlog.Infof(nil, \"message to log: %d\", 1)\nlog.Infof(karma.Describe(\"key\", \"value\"), \"message to log: %d\", 1)\n\nerr := errors.New(\"some error\")\nlog.Fatalf(\n    karma.Describe(\"context\", \"testing error\").Reason(err),\n    \"message to log: %d\",\n    1,\n)\n```\n\nTo see more examples of how to use `karma` for structured logging and error\nreporting, consider [looking at tests and examples][1].\n\n## Motivation\n\nFollowing package offers significant improvements above `logrus` and similar\nstructured loggers:\n\n* Readable tree-like log entries in stderr, which makes easy to debug program,\n  because log is more readable.\n* Allows to use context errors, that used to describe errors on all call-stack\n  levels to ease finding problems and fixing them.\n* Sends logs to ES in key-value format like other structured loggers.\n* Does not change ordering of key-values in the context.\n\n[1]: https://github.com/reconquest/karma-go/blob/f802f635edd15c647995280b90f7de3e84ca8999/karma_test.go\n\n# License\n\nThis project is licensed under the terms of the MIT license.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freconquest%2Fcog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freconquest%2Fcog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freconquest%2Fcog/lists"}