{"id":20589584,"url":"https://github.com/christophberger/what","last_synced_at":"2026-04-22T04:02:37.625Z","repository":{"id":73385786,"uuid":"235874631","full_name":"christophberger/what","owner":"christophberger","description":"debug-level logging for developers","archived":false,"fork":false,"pushed_at":"2020-04-11T14:01:46.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-06T13:34:08.406Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/christophberger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-01-23T19:56:04.000Z","updated_at":"2020-04-11T14:01:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"a7d2847a-acaf-47ff-8a0b-e4b22ce0b75d","html_url":"https://github.com/christophberger/what","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/christophberger/what","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophberger%2Fwhat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophberger%2Fwhat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophberger%2Fwhat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophberger%2Fwhat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christophberger","download_url":"https://codeload.github.com/christophberger/what/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophberger%2Fwhat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32120402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T00:31:26.853Z","status":"online","status_checked_at":"2026-04-22T02:00:05.693Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-16T07:29:55.555Z","updated_at":"2026-04-22T04:02:37.600Z","avatar_url":"https://github.com/christophberger.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What: debug-level logging that vanishes from production code\n\n## What does what do\n\n`what` is a set of simple and easy logging functions, suitable for tracing any kind of activities in your code. `what` can print the current function name, quickly `Printf`-format your data, and pretty-print data structures. \n\n## Who need this? \n\nYou definitely should give `what` a closer look if you -\n\n* heartily agree to [Dave Cheney's article about logging](https://dave.cheney.net/2015/11/05/lets-talk-about-logging), or\n* want to keep your production code free from *any* log or trace output. (Think security!) \n\n## How does it work?\n\n### Available functions\n\n```go\nwhat.Happens(\"Foo: %s\", bar) // log.Printf(\"Foo: %s\\n\", bar)\nwhat.If(cond, \"Foo: %s\", bar) // only print if cond is true\nwhat.Func() // Print out the fully qualified function name\nwhat.Is(var) // Pretty-print var \n```\n\nSpread these calls across your code, especially in places you want to observe closer. \n\nDebug-level logging is useful alongside unit testing as well as using a debugger. It does not attempt to replace any of these concepts.\n\n### Enabling and disabling\n\n#### Enable all functions\n\nSimply pass the `what` tag to `go build`, `go install`, `go test` etc:\n\n```sh\ngo build -tags what\n```\n\nAnd now just lean back and see your code talking about what it does.\n\n#### Enable specific functions\n\nTo reduce the noise, you can decide to compile only specific parts of `what`:\n\n* `whathappens` only enables `what.Happens()` and `what.If()`.\n* `whatfunc` only enables `what.Func()`.\n* `whatis` only enables `what.Is()`.\n\nAll disabled functions get replaced by no-ops.\n\nExample:\n\n```sh\ngo build -tags whathappens\n```\n\nYou can also choose a combination of the above, for example: `go build -tags whathappens,whatis`\n\n\n#### Disable what\n\nNothing easier than that! Without any of the above build tags, all funtions get replace by no-ops, ready for being optimized away entirely (if the compiler decides to do so).\n\n* No log output \n* No bloated binary\n* No security leak from chatty binaries.\n\n## Non-features\n\n* Uses only stdlib `log`, no custom logger configurable\n* No custom pretty-printer","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophberger%2Fwhat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristophberger%2Fwhat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophberger%2Fwhat/lists"}