Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kirillDanshin/dlog
Simple build-time controlled debug log with ability to log where the logger was called
https://github.com/kirillDanshin/dlog
compile-time-enabling debug debuging-tool dlog golang log
Last synced: 10 days ago
JSON representation
Simple build-time controlled debug log with ability to log where the logger was called
- Host: GitHub
- URL: https://github.com/kirillDanshin/dlog
- Owner: kirillDanshin
- License: apache-2.0
- Created: 2016-07-04T19:59:09.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-28T00:08:08.000Z (over 7 years ago)
- Last Synced: 2024-10-23T02:55:27.527Z (13 days ago)
- Topics: compile-time-enabling, debug, debuging-tool, dlog, golang, log
- Language: Go
- Homepage:
- Size: 20.5 KB
- Stars: 17
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - dlog - Compile-time controlled logger to make your release smaller without removing debug calls. (Utilities / Utility/Miscellaneous)
- awesome-go - dlog - Simple build-time controlled debug log with ability to log where the logger was called - ★ 15 (Utilities)
- awesome-go-extra - dlog - time controlled debug log with ability to log where the logger was called|16|2|0|2016-07-04T19:59:09Z|2017-07-28T00:08:08Z| (Utilities / Fail injection)
README
# dlog [![GoDoc](https://godoc.org/github.com/kirillDanshin/dlog?status.svg)](https://godoc.org/github.com/kirillDanshin/dlog) [![Go Report Card](https://goreportcard.com/badge/github.com/kirillDanshin/dlog)](https://goreportcard.com/report/github.com/kirillDanshin/dlog)
Simple build-time controlled debug log# How to use
### Unbuffered
```go
package mainimport "github.com/kirillDanshin/dlog"
func main() {
a := []int{2, 4, 8, 16, 32, 64, 128, 256, 512}
b := "some string"
dlog.D(a) // D'ump `a`
dlog.P(b) // P'rint `b`
dlog.F("%s format", b) // F'ormatted print
dlog.Ln(b) // print'Ln `b`
}
```### Buffered
```go
package mainimport "github.com/kirillDanshin/dlog"
func main() {
log := dlog.NewBuffered()
defer log.Release()
log.D(a) // D'ump `a`
log.P(b) // P'rint `b`
log.F("%s format", b) // F'ormatted print
log.Ln(b) // print'Ln `b`dlog.Ln(log) // or fmt.Println("log") etc.
}
```# Release
To disable logging in release build just run
```bash
go build
```# Debug
To enable logging in debug build run
```bash
go build -tags "debug"
```