Categorygithub.com/sjsafranek/logger
repositorypackage
1.0.5
Repository: https://github.com/sjsafranek/logger.git
Documentation: pkg.go.dev

# README

logger

Code coverage Build Status Go Doc

Simplistic, opinionated logging for Golang

  • Zero dependencies
  • Global logger (with optional local logger)
  • Leveled
  • Useful defaults / i.e. zero-config
  • Simple API
  • Colors on Linux (Windows colors are horrible and unnessecary)
[trace] 20:04:57.670116 logger.go:125: trace shows granular timestamp and line info
[debug] 20:04:57 logger.go:129: debug shows regular timestamp and line info
[info]  2019/05/08 20:04:57 info shows timestamp
[warn]  2019/05/08 20:04:57 warn shows timestamp
[error] 2019/05/08 20:04:57 logger.go:141: error shows timestamp and line info

2022-12-12T06:05:59.863Z [TRACE] [12028] logger_test.go:18: trace
2022-12-12T06:05:59.864Z [DEBUG] [12028] logger_test.go:18: debug
2022-12-12T06:05:59.865Z [INFO]  [12028] logger_test.go:18: info
2022-12-12T06:05:59.866Z [WARN]  [12028] logger_test.go:18: warn
2022-12-12T06:05:59.867Z [ERROR] [12028] logger_test.go:18: error
PASS
ok      github.com/sjsafranek/logger    0.272s

Install

go get github.com/sjsafranek/logger

Usage

package main

import (
	log "github.com/sjsafranek/logger"
)

func main() {
	log.SetLevel("debug")
	log.Debug("hello, world")
}

Contributing

Pull requests are welcome. Feel free to...

  • Revise documentation
  • Add new features
  • Fix bugs
  • Suggest improvements

License

MIT