{"id":29271226,"url":"https://github.com/securisec/go-debug","last_synced_at":"2025-07-04T23:08:14.280Z","repository":{"id":57555556,"uuid":"311813633","full_name":"securisec/go-debug","owner":"securisec","description":null,"archived":false,"fork":false,"pushed_at":"2020-11-20T23:48:37.000Z","size":31,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-28T14:03:11.258Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/securisec.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":"2020-11-10T23:51:47.000Z","updated_at":"2021-08-12T01:51:31.000Z","dependencies_parsed_at":"2022-09-14T12:31:11.618Z","dependency_job_id":null,"html_url":"https://github.com/securisec/go-debug","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/securisec/go-debug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/securisec%2Fgo-debug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/securisec%2Fgo-debug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/securisec%2Fgo-debug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/securisec%2Fgo-debug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/securisec","download_url":"https://codeload.github.com/securisec/go-debug/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/securisec%2Fgo-debug/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263632058,"owners_count":23491530,"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":"2025-07-04T23:08:11.564Z","updated_at":"2025-07-04T23:08:14.270Z","avatar_url":"https://github.com/securisec.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-debug\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://i.imgur.com/L1EO89a.png\" width=\"80%\"\u003e\n\u003c/p\u003e\n\n`go-debug` is a similar library to [npm debug package](https://github.com/visionmedia/debug). This module was written mostly for personal consumption and does not offer anywhere near the amount of customization offered by the npm package.\n\n`go-debug` uses the `DEBUG` envrionment variable to log data. This envar can contain multiple comma seperated values indicating different namespaces. If a `*` is used as the value of this envar, it will log all namespaces. If the envar does not have any value set, all logs will be ignored.\n\nGeneral rules to remember when setting the `DEBUG` environment:\n- Multiple namespaces can be specified with a `,`\n- `*` Will log all\n- `TAG` Will log tag only\n- `!TAG` Will not be logged\n\nExample:\n`export DEBUG=APP`\n```go\ndebugMe := gdebug.New()\ndebugMe(\"some log\")\n// This will not log\n\nnewDebug := debug.New(debug.Config{\n    Namespace: \"APP\",\n    Style: []color.Attribute{\n        Yellow,\n        Bold,\n    },\n})\nnewDebug(\"something\", 1, true)\n// This will log\n```\n\n## Install\n```bash\ngo get -u github.com/securisec/go-debug\n```\n\n## Example\n\n```go\npackage main\n\nimport (\n\t\"github.com/fatih/color\"\n\tgdebug \"github.com/securisec/go-debug\"\n)\n\nfunc main() {\n\tdebugApp := gdebug.New()\n\tdebugApp(\"Hello\")\n\n\tdebugPretty := gdebug.New(gdebug.Config{\n\t\tNamespace: \"PRETTY\",\n\t\tStyle:     []color.Attribute{gdebug.Blue},\n\t\tPretty:    true,\n\t})\n\tt := \u0026Test{\n\t\tSome:    \"some\",\n\t\tAnother: true,\n\t\tData: Data{\n\t\t\tSomething: \"something\",\n\t\t},\n\t}\n\tdebugPretty(t)\n\n\tdebugError := gdebug.New(gdebug.Config{Namespace: \"ERROR\", Style: []color.Attribute{gdebug.Red}})\n\tdebugError(t)\n\tdebugWarning := gdebug.New(gdebug.Config{Namespace: \"WARNING\", Style: []color.Attribute{gdebug.Yellow}})\n\tdebugWarning(\"Warning\", \"message\")\n}\n\ntype Test struct {\n\tSome    string\n\tAnother bool\n\tData    Data\n}\n\ntype Data struct {\n\tSomething string\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecurisec%2Fgo-debug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsecurisec%2Fgo-debug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecurisec%2Fgo-debug/lists"}