{"id":13413296,"url":"https://github.com/clok/kemba","last_synced_at":"2025-10-31T06:30:41.445Z","repository":{"id":37253521,"uuid":"279197216","full_name":"clok/kemba","owner":"clok","description":"A tiny debug logging tool. Ideal for CLI tools and command applications. Inspired by https://github.com/visionmedia/debug","archived":false,"fork":false,"pushed_at":"2025-01-26T10:09:50.000Z","size":105,"stargazers_count":14,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-14T06:02:52.190Z","etag":null,"topics":["awesome","awesome-go","awesome-golang","awesome-list","cli","debug","debugging","go","golang","golang-library","logging"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/clok/kemba?tab=overview","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/clok.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"github":["clok"]}},"created_at":"2020-07-13T03:10:54.000Z","updated_at":"2025-02-01T18:57:12.000Z","dependencies_parsed_at":"2024-02-19T23:08:26.627Z","dependency_job_id":"d29e6e49-717a-4843-b1be-36b759f16e56","html_url":"https://github.com/clok/kemba","commit_stats":{"total_commits":89,"total_committers":5,"mean_commits":17.8,"dds":0.5280898876404494,"last_synced_commit":"f243684ac448535af8c6d296131847221b530e12"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clok%2Fkemba","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clok%2Fkemba/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clok%2Fkemba/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clok%2Fkemba/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clok","download_url":"https://codeload.github.com/clok/kemba/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239132545,"owners_count":19587106,"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":["awesome","awesome-go","awesome-golang","awesome-list","cli","debug","debugging","go","golang","golang-library","logging"],"created_at":"2024-07-30T20:01:37.078Z","updated_at":"2025-10-31T06:30:41.402Z","avatar_url":"https://github.com/clok.png","language":"Go","funding_links":["https://github.com/sponsors/clok"],"categories":["Logging","日志记录","Logging 日志库","Relational Databases"],"sub_categories":["Search and Analytic Databases","Advanced Console UIs","检索及分析资料库","SQL 查询语句构建库"],"readme":"# kemba\n[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://github.com/clok/kemba/blob/master/LICENSE)\n[![Go Report Card](https://goreportcard.com/badge/clok/kemba)](https://goreportcard.com/report/clok/kemba)\n[![Coverage Status](https://coveralls.io/repos/github/clok/kemba/badge.svg)](https://coveralls.io/github/clok/kemba)\n[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white)](https://pkg.go.dev/github.com/clok/kemba?tab=overview)\n[![Mentioned in Awesome\nGo](https://awesome.re/mentioned-badge-flat.svg)](https://github.com/avelino/awesome-go)\n\n`debug` logging tool inspired by https://github.com/visionmedia/debug\n\n#### Why is it named `kemba`?\n\n`debug` is more generally considered to be [`runtime/debug`](https://golang.org/pkg/runtime/debug/) within Go. Since this takes heavy inspiration from my experiences using the `npm` module [`debug`](https://github.com/visionmedia/debug) I wanted to find a word that was somewhat connected to the inspiration. According to [Google translate](https://www.google.com/search?q=debug+in+icelandic) \"debug\" in English translated to Icelandic results in \"kemba\".\n\n## Usage\n\nThe `kemba` logger reads the `DEBUG` and `KEMBA` environment variables to determine if a log line should be output. The logger outputs to `STDERR`.\n\nWhen it is not set, the logger will immediately return, taking no action.\n\nWhen the value is set (ex. `DEBUG=example:*,tool:details` and/or `KEMBA=plugin:fxn:start`), the logger will determine if it should be `enabled` when instantiated.\n\nThe value of these flags can be a simple regex alternative where a wildcard (`*`) are replaced with `.*` and all terms are prepended with `^` and appended with `$`. If a term does not include a wildcard, then an exact match it required.\n\nExample of a wildcard in the middle of a tag string: `DEBUG=example:*:fxn` will match tags like `[example:tag1:fxn, example:tag2:fxn, example:anything:fxn, ...]`\n\nTo disabled colors, set the `NOCOLOR` environment variable to any value.\n\n![image](https://user-images.githubusercontent.com/1429775/88557149-7973ff80-cfef-11ea-8ec2-ff332fd1b25f.png)\n\n```go\npackage main\n\nimport (\n    \"time\"\n\n\t\"github.com/clok/kemba\"\n)\n\ntype myType struct {\n\ta, b int\n}\n\n// When the DEBUG or KEMBA environment variable is set to DEBUG=example:* the kemba logger will output to STDERR\nfunc main () {\n    k := kemba.New(\"example:tag\")\n\t\n    var x = []myType{\n    \t{1, 2},\n    \t{3, 4},\n    }\n    k.Printf(\"%#v\", x)\n    // Output to os.Stderr\n    // example:tag []main.myType{main.myType{a:1, b:2}, main.myType{a:3, b:4}} +0s\n\n    // Artificial delay to demonstrate the time tagging\n    time.Sleep(250 * time.Millisecond)\n    k.Printf(\"%# v\", x)\n    k.Println(x)\n\n    // Artificial delay to demonstrate the time tagging\n    time.Sleep(100 * time.Millisecond)\n    k.Log(x)\n    // All result in the same output to os.Stderr\n    // example:tag []main.myType{ +XXms\n    // example:tag     {a:1, b:2},\n    // example:tag     {a:3, b:4},\n    // example:tag }\n\n    // Create a new logger with an extended tag\n    k1 := k.Extend(\"1\")\n    k1.Println(\"a string\", 12, true)\n    // Output to os.Stderr\n    // example:tag:1 a string +0s\n    // example:tag:1 int(12)\n    // example:tag:1 bool(true)\n}\n```\n\n## Development\n\n1. Fork the [clok/kemba](https://github.com/clok/kemba) repo\n1. Use `go \u003e= 1.16`\n1. Branch \u0026 Code\n1. Run linters :broom: `golangci-lint run`\n    - The project uses [golangci-lint](https://golangci-lint.run/usage/install/#local-installation)\n1. Commit with a Conventional Commit\n1. Open a PR","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclok%2Fkemba","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclok%2Fkemba","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclok%2Fkemba/lists"}