{"id":19865828,"url":"https://github.com/appliedgocode/what","last_synced_at":"2026-01-12T00:39:06.306Z","repository":{"id":57524630,"uuid":"254883821","full_name":"appliedgocode/what","owner":"appliedgocode","description":"Debug-level logging for developers (only!)","archived":false,"fork":false,"pushed_at":"2025-01-17T11:00:24.000Z","size":43,"stargazers_count":101,"open_issues_count":1,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-02T05:47:01.679Z","etag":null,"topics":["debugging","logging"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appliedgocode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2020-04-11T14:20:30.000Z","updated_at":"2025-03-03T02:13:32.000Z","dependencies_parsed_at":"2024-06-18T20:12:35.373Z","dependency_job_id":"2167de13-1d5a-4c3f-b52f-6e8a568db5a5","html_url":"https://github.com/appliedgocode/what","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/appliedgocode/what","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appliedgocode%2Fwhat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appliedgocode%2Fwhat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appliedgocode%2Fwhat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appliedgocode%2Fwhat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appliedgocode","download_url":"https://codeload.github.com/appliedgocode/what/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appliedgocode%2Fwhat/sbom","scorecard":{"id":203877,"data":{"date":"2025-08-11","repo":{"name":"github.com/appliedgocode/what","commit":"8d5847755311ac0d997770480b87d9d10eed27de"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T23:17:40.330Z","repository_id":57524630,"created_at":"2025-08-16T23:17:40.331Z","updated_at":"2025-08-16T23:17:40.331Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28329806,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"ssl_error","status_checked_at":"2026-01-12T00:36:15.229Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["debugging","logging"],"created_at":"2024-11-12T15:24:17.531Z","updated_at":"2026-01-12T00:39:06.289Z","avatar_url":"https://github.com/appliedgocode.png","language":"Go","readme":"# What: debug-level logging that vanishes from production code\n\n[![Go Reference](https://pkg.go.dev/badge/appliedgo.net/what.svg)](https://pkg.go.dev/appliedgo.net/what)\n\n## How to import the package\n\n```go\nimport \"appliedgo.net/what\"\n```\n(Do not use the direct path to the repo.)\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 dumps data structures. \n\nAnd last not least, no `what` calls reach your production binary (unless you want it so). Debug-level logging is for developers only. *No more accidental data leaks in production through left-over debug logging statements.*\n\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\nFirst of all, `what` is intended for debug-level logging *only*. So,\n\n* Use `what` for tracing and debugging your code. (\"Does my code do what I intended? Does this variable contain what I expect? Why does the loop not stop when the break condition *should* be fulfilled?...\")\n* Use `log` for user-facing log output. (\"What was the app doing before it said, 'cannot connect to server'? Did that service already sync or is it still waiting for other services?...\")\n\nYou have to explicitly enable `what` logging through build flags (see below).\n\n## Why not just firing up a debugger?\n\n`what` is one of many debugging techniques. Sometimes, a little log output can prevent a time-consuming debugger session. `what` does not replace but complement your debugger.\n\n### Available functions\n\n```go\nwhat.Happens(\"Foo: %s\", bar) // log.Printf(\"Foo: %s\\n\", bar)\nwhat.Happens(\"INFO\", \"message\", \"key1\", value1) // like slog.Info()\nwhat.If(cond, \"Foo: %s\", bar) // only print if cond is true\nwhat.Func() // Print out the fully qualified function name\nwhat.Is(var) // Dump the structure and contents of var. Is() recognizes a DebugStringer.\nwhat.Package() // Print the current package's name\n```\n\nSpread these calls across your code, especially in places you want to observe closer. \n\n`what.Happens()` has two modes. \n\nIf the format string is either of \"DEBUG\", \"INFO\", \"WARN\", or \"ERROR\", the behavior is like `slog.Debug()`, `slog.Info()`, and so on. The first argument after the level keyword is the log message, and all subsequent arguments are key/value pairs, where the value can be of any type.\n\nIf the format string is none of the above keywords, `what.Happens()` behaves like `log.Printf()`. \n\nDebug-level logging with `what` 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`what` logging can be enabled and disabled through build tags.\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* `whatis` only enables `what.Is()`.\n* `whatfunc` only enables `what.Func()`.\n* `whatpackage` only enables `what.Package()`.\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#### Enable debug logging for specific packages only\n\nGo's build tag mechanism cannot help here, so this is done through an environment variable called \"WHAT\".\n\nTo enable specific packages for debug logging, set `WHAT` to a package name, or a list of package names.\n\n\n\n#### Disable what\n\nNothing easier than that! Without any of the above build tags, all functions get replaced 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 variable dumper/pretty-printer. At the moment, `what` uses `github.com/davecgh/go-spew`. See Spew's docs about the syntax used for printing a variable.\n\n## Restrictions\n\nAlthough `go run` should recognize all build flags that `go build` recognizes (including `-tags`), it seems that `go run main.go -tags what` does not consider the `what` tag. Use `go build -tags what \u0026\u0026 ./main` instead.\n\n## Compatibility\n\n- v0.1.6 and later require Go 1.18 (replacement of `interface{}` with `any`)\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappliedgocode%2Fwhat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappliedgocode%2Fwhat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappliedgocode%2Fwhat/lists"}