{"id":24108205,"url":"https://github.com/yosev/debugo","last_synced_at":"2026-03-07T11:31:28.972Z","repository":{"id":271565084,"uuid":"913570131","full_name":"YoSev/debugo","owner":"YoSev","description":"debugo is a lightweight Go implementation inspired by the popular debug-js library. This package aims to provide simple, human-friendly and foremost fine-graded debugging output for Go developers.","archived":false,"fork":false,"pushed_at":"2025-01-30T21:46:31.000Z","size":41,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T22:32:35.627Z","etag":null,"topics":["debug","debug-js","debugjs","debugo","go","log","logger","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/YoSev.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-08T00:08:17.000Z","updated_at":"2025-01-30T21:46:34.000Z","dependencies_parsed_at":"2025-01-09T01:15:16.500Z","dependency_job_id":null,"html_url":"https://github.com/YoSev/debugo","commit_stats":null,"previous_names":["yosev/debugo"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YoSev%2Fdebugo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YoSev%2Fdebugo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YoSev%2Fdebugo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YoSev%2Fdebugo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YoSev","download_url":"https://codeload.github.com/YoSev/debugo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241090610,"owners_count":19907983,"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":["debug","debug-js","debugjs","debugo","go","log","logger","logging"],"created_at":"2025-01-10T23:26:23.701Z","updated_at":"2026-03-07T11:31:28.904Z","avatar_url":"https://github.com/YoSev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# debugo\n\n\u003cimg width=\"647\" src=\"https://github.com/user-attachments/assets/2b5d9516-ae54-4868-ae5b-c9cef13015cc\" alt=\"debugo\" /\u003e\n\ndebugo is a lightweight Go implementation inspired by the popular [debug-js](https://github.com/debug-js/debug) library. This package aims to provide simple, human-friendly and foremost fine-graded debugging output for Go developers.\n\n![CI](https://github.com/yosev/debugo/actions/workflows/go.test.yml/badge.svg)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## Features\n\n- Namespace-based (colored) debugging to categorize log output.\n- Toggle debugging on or off via environment variables or programmatically.\n\n## Installation\n\nTo install `debugo`, use `go get`:\n\n```bash\ngo get github.com/yosev/debugo\n```\n\n## Usage\n\nUsing `debugo` is straightforward. Here's a basic example:\n\n```go\npackage main\n\nimport (\n\t\"github.com/yosev/debugo\"\n)\n\nfunc main() {\n\tdebugo.SetDebug(\"*\") // overwrites DEBUGO env\n\tdebug := debugo.New(\"my:namespace\")\n\n    // debug (using fmt.Sprint)\n\tdebug.Debug(\"This is a debug message.\", 420.69, true, struct {\n\t\tFoo string\n\t}{Foo: \"bar\"})\n\n    // debug formated (using fmt.Sprintf)\n    debug.Debugf(\"This is a debug message %d %v %v\", 420.69, true, struct {\n\t\tFoo string\n\t}{Foo: \"bar\"})\n}\n\n// outputs: my:namespace This is a debug message. 420.69 true {Foo: bar} +0ms\n```\n\n### Environment Variables\n\nYou can control which debug namespaces are active using the `DEBUG` environment variable. For example:\n\n```bash\nexport DEBUGO=my:namespace\n```\n\nThis will enable debugging for the `my:namespace` namespace. To enable multiple namespaces, separate them with commas:\n\n```bash\nexport DEBUGO=my:namespace,your:namespace\n```\n\nTo enable all namespaces, use:\n\n```bash\nexport DEBUGO=*\n```\n\n### Disabling Debugging\n\nTo turn off debugging, unset the `DEBUGO` environment variable:\n\n```bash\nunset DEBUGO\n```\n\n## Configuration\n\n`debugo` allows you to customize its behavior through the `Options` struct. These options let you fine-tune how logs are output and processed.\n\n### Available Options\n\n```go\ntype Options struct {\n    // Force log output independent of given namespace matching (default: false)\n    ForceEnable bool\n    // Use background colors over foreground colors (default: false)\n    UseBackgroundColors bool\n    // Use a static color (github.com/fatih/color) (default: random foreground color)\n    Color *color.Color\n    // Defines the pipe to output to, eg. stdOut (default: stdErr)\n    Output *os.File\n    // Write log files in their own go routine (maintains order)\n    Threaded bool\n    // Enable leading timestamps by adding a time format\n    Timestamp *Timestamp\n}\n```\n\n### Using Options\n\nTo create a new logger with specific options, use the `NewWithOptions` function:\n\n#### Example\n\n```go\npackage main\n\nimport (\n    \"github.com/yosev/debugo\"\n    \"github.com/fatih/color\"\n    \"os\"\n)\n\nfunc main() {\n    options := \u0026debugo.Options{\n        ForceEnable:         true,\n        UseBackgroundColors: false,\n        Color:               color.New(color.FgRed).Add(color.Underline),\n        Output:              os.Stdout,\n        Threaded:            true,\n        Timestamp:           \u0026debugo.Timestamp{Format: time.Kitchen},,\n    }\n\n    debug := debugo.NewWithOptions(\"myapp\", options)\n\n    debug.Debug(\"This is a custom debug message with configured options.\")\n}\n```\n\n### Extend\n\nYou can simply extend debugger\n\n```go\ndebugSign := debugo.New(\"sign\")\n\n// clones into a new debug instance with extended namespace\ndebugSignIn := debugSign.Extend(\"in\")\ndebugSignUp := debugSign.Extend(\"up\")\ndebugSignOut := debugSign.Extend(\"out\")\n\ndebugSign.Debug(\"hello\"); // sign hello\ndebugSignIn.Debug(\"hello\"); // sign:in hello\ndebugSignUp.Debug(\"hello\"); // sign:up hello\ndebugSignOut.Debug(\"hello\"); // sign:out hello\n```\n\n## Comparison to `debug-js`\n\nWhile `debugo` is inspired by `debug-js`, it is a simplified version tailored for Go. It does not implement all features of `debug-js`, focusing on core debugging functionality for Go developers.\n\n## Contributing\n\nContributions are welcome! If you find a bug or have a feature request, feel free to open an issue or submit a pull request.\n\n1. Fork the repository.\n2. Create a feature branch: `git checkout -b my-new-feature`.\n3. Commit your changes: `git commit -am 'Add some feature'`.\n4. Push to the branch: `git push origin my-new-feature`.\n5. Submit a pull request.\n\n## License\n\n`debugo` is released under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Inspired by [debug-js](https://github.com/debug-js/debug).\n- Thanks to the open-source community for the inspiration and guidance.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyosev%2Fdebugo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyosev%2Fdebugo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyosev%2Fdebugo/lists"}