Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chewxy/inkhuffer
Printf on Steroids!
https://github.com/chewxy/inkhuffer
Last synced: 30 days ago
JSON representation
Printf on Steroids!
- Host: GitHub
- URL: https://github.com/chewxy/inkhuffer
- Owner: chewxy
- License: mit
- Created: 2017-11-15T12:32:40.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-06-16T03:00:39.000Z (over 3 years ago)
- Last Synced: 2024-06-21T06:00:36.109Z (5 months ago)
- Language: Go
- Size: 3.91 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# package `inkhuffer`
package `inkhuffer` is a package that provides debugging-by-print-statement harnesses. It's essentially `printf` statements on steroids. Annotate your code with print statements to trace execution. The extra features this package provides over normal print statements is scope tracking (manually managed of course).
Think of this as a debugger where your step-throughs are logged to a file.
# Rational #
The intent is that this package should only be used during initial development and debug phases - this is useful for tracing execution of particular code paths without using a debugger.This package is NOT a logging solution. It's NOT a debugger solution either.
The idea behind this is rather simple: There are "scopes" of execution in the flow of normal code. Take for example this snippet:
```go
func A() {
B()
}func B() {
C()
D()
}func C() {
// do work
}func D() {
// do work
}```
The flow of execution can be visualized as such:
```
A()
-> B()
-> C()
-> D()
```Here we see `C()` and `D()` are pretty much on the same "scope" of execution scope.
Of course, scopes are not just limited to function calls. Scopes can be semantic in nature. This package offers only annotation capacity, and does not restrict on (ab)use.
# Poor Designs #
This package is intentionally poorly designed - the use of global variables is rife, and it's guaranteed to not play well with concurrency.
The purpose as previously mentioned, is to aid in development and rapid understanding of the semantics of the program you're developing. You're not supposed to keep using this package.
# Usage #
If you import this package you will note that most functions are NO-OPs. To use it properly you need to use the `tags=debug` build tag.