mirror of
https://github.com/nxshock/simplelog.git
synced 2026-12-04 00:59:37 +05:00
No description
- Go 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| consts.go | ||
| go.mod | ||
| go.sum | ||
| loglevel.go | ||
| loglevel_test.go | ||
| message.go | ||
| period.go | ||
| progress.go | ||
| progress_test.go | ||
| progressitems.go | ||
| README.md | ||
| remaining.go | ||
| shortify.go | ||
| shortify_test.go | ||
| simplelog.go | ||
| speed.go | ||
| until.go | ||
simplelog
Simple logging library for Go.
Usage
// Create logger
log := NewLogger(os.Stderr) // To terminal - with colorful messages
log := NewLogger(any io.Writer) // To file - without colors
// Print messages
log.Info("info message")
log.Warnf("warning message: %s is suspicious", "something")
log.Errorf("error message: %s", "something goes wrong")
log.Fatal("unacceptable")
// Progress message
estimated := uint(100)
progress := log.StartProgress(estimated) // start progress
for i:=0;i<100;i++ {
progress.IncrementProgress(1) // incremeting progress will trigger updating of progress indicator
}
progress.Finish() // stop progress
log.Infof("Processed %d items.") // overwrite last progress message with your custom finish message