`gg()` is a lo**gg**er/debu**gg**er with several advantages:
npm install @leftium/gggg() is a logger/debugger with several advantages:
- Annotated with automatic _namespace_ based on source file and calling function.
- Each namespace gets a unique color for easier visual parsing.
- Simple syntax with wildcards to filter/hide debug output at runtime.
- Millisecond diff (timestamps) for each namespace.
- Can be inserted into the middle of expressions (returns the value of the first argument).
- Can output a link that opens the source file in your editor (like VS Code).
- Simple to disable (turn all loggs into NOP's for production).
- Diagnostics/hints in dev console & terminal to help install and configure correctly.
- Faster to type.
```
npm add @leftium/gg
_Coming soon..._
This library includes a patched version of the debug package. The patch reformats the output to display time diffs before the namespace for better readability:
Standard debug output:
``
gg:routes/+page.svelte +123ms
Patched output (this library):
``
+123ms gg:routes/+page.svelte
The patched debug library is bundled directly into the distribution, so consumers automatically get the correct behavior without needing to install or patch debug themselves.
When a new version of debug is released:
1. Update debug: pnpm add debug@x.x.xpnpm patch debug@x.x.x
2. Update patch: (apply changes, then pnpm patch-commit)./scripts/update-debug.sh
3. Run the update script: git diff src/lib/debug/src/
4. Verify patches are present: pnpm dev
5. Test dev mode: pnpm prepack
6. Test production build: git commit -am "Update bundled debug to x.x.x"
7. Commit changes:
The patch is maintained in patches/debug@4.4.3.patch for reference.
Note: debug` is kept in dependencies (not devDependencies) to support both dev and production modes.
> A tiny JavaScript debugging utility modelled after Node.js core's debugging technique. Works in Node.js and web browsers.
- https://www.npmjs.com/package/debug
> Quick and dirty debugging output for tired programmers.
- https://github.com/zestyping/q
- Hacker News discussion
- PyCon lightning talk
> Never use print() to debug again
- https://github.com/gruns/icecream
- Hacker News discussion