Skip to content
/ log Public

📃 A lightweight, leveled logging package for Go.

License

Notifications You must be signed in to change notification settings

tevino/log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a445c00 Â· May 19, 2020

History

22 Commits
Nov 25, 2016
Nov 25, 2016
Oct 11, 2019
Oct 11, 2019
Oct 26, 2018
May 19, 2020
May 19, 2020
Oct 11, 2019
Oct 11, 2019
Oct 26, 2018
Nov 28, 2016
May 19, 2020
Oct 11, 2019
Nov 28, 2016
Nov 28, 2016
May 19, 2020
Dec 6, 2016
Dec 6, 2016

Repository files navigation

log

A lightweight, leveled logging package for Go.

Install

go get github.com/tevino/log

Features

  • Leveled logging and filtering
  • Colored output
  • Log with file name and line number

Example

import "github.com/tevino/log"

log.SetOutputLevel(log.INFO)

log.Debugf("Output level is %s.", log.OutputLevel())
log.Info("Thus only this line is printed.")

Benchmark

BenchmarkLog15-4              300000          4391 ns/op        1202 B/op         16 allocs/op
BenchmarkLogrus-4             500000          3444 ns/op        1715 B/op         24 allocs/op
BenchmarkLoggo-4              500000          3275 ns/op         344 B/op         11 allocs/op
BenchmarkGoLogging-4         1000000          1136 ns/op         601 B/op         10 allocs/op
BenchmarkThisPackage-4       3000000           731 ns/op         214 B/op          2 allocs/op
BenchmarkStdLog-4            2000000           571 ns/op         174 B/op          2 allocs/op

Acknowledgements

  • @kirk91: Provide APIs to make it possible for user to specify a custom caller offset.