https://github.com/davidmz/debug-log
A thin logger inspired by the NPM's debug
https://github.com/davidmz/debug-log
debug golang log logging
Last synced: 6 months ago
JSON representation
A thin logger inspired by the NPM's debug
- Host: GitHub
- URL: https://github.com/davidmz/debug-log
- Owner: davidmz
- License: mit
- Created: 2020-04-21T08:23:07.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-13T11:10:21.000Z (about 2 years ago)
- Last Synced: 2024-06-13T13:57:19.804Z (about 2 years ago)
- Topics: debug, golang, log, logging
- Language: Go
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# debug-log
[](https://godoc.org/github.com/davidmz/debug-log)
[](https://github.com/davidmz/debug-log/blob/master/LICENSE.txt)
The `debug-log` Go package (imported as `debug`) provides a thin logger inspired by the NPM's
[debug](https://www.npmjs.com/package/debug) package. It outputs the log messages depending on the
DEBUG environment variable.
Example of usage:
```go
package main
import (
"os"
"github.com/davidmz/debug-log"
)
func main() {
_ = os.Setenv("DEBUG", "myproject:*")
testLogger := debug.NewLogger("myproject:test")
testLogger.Println("log line")
// Output: TIMESTAMP [myproject:test] log line
}
```