hdkv
/
fwzookeeper
Archived
1
Fork 0
This repository has been archived on 2022-11-04. You can view files and clone it, but cannot push or open issues/pull-requests.
fwzookeeper/vendor/github.com/kirillDanshin/dlog
Vladimir Hodakov ca1c52fc39
Initial commit
2018-11-29 20:32:51 +04:00
..
.gitignore Initial commit 2018-11-29 20:32:51 +04:00
LICENSE Initial commit 2018-11-29 20:32:51 +04:00
README.md Initial commit 2018-11-29 20:32:51 +04:00
buffered_disabled.go Initial commit 2018-11-29 20:32:51 +04:00
buffered_enabled.go Initial commit 2018-11-29 20:32:51 +04:00
buffered_uni.go Initial commit 2018-11-29 20:32:51 +04:00
caller.go Initial commit 2018-11-29 20:32:51 +04:00
consts.go Initial commit 2018-11-29 20:32:51 +04:00
dlog_disabled.go Initial commit 2018-11-29 20:32:51 +04:00
dlog_enabled.go Initial commit 2018-11-29 20:32:51 +04:00
doc.go Initial commit 2018-11-29 20:32:51 +04:00
state_disabled.go Initial commit 2018-11-29 20:32:51 +04:00
state_enabled.go Initial commit 2018-11-29 20:32:51 +04:00
withCaller_disabled.go Initial commit 2018-11-29 20:32:51 +04:00
withCaller_enabled.go Initial commit 2018-11-29 20:32:51 +04:00
withCaller_uni.go Initial commit 2018-11-29 20:32:51 +04:00

README.md

dlog GoDoc Go Report Card

Simple build-time controlled debug log

How to use

Unbuffered

package main

import "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

package main

import "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

	go build

Debug

To enable logging in debug build run

	go build -tags "debug"