/log

Simple logging interface and common loggers for injection into other packages

Primary LanguageGo

log GoDoc Go Report Card

Simple logging interface and common loggers for injection into other packages

This package supplies a thread-safe logger, a simple logging interface and commonly used logging destinations. Currently supported implementations are

  • Text (writes to Stdout/Stderr by default)
  • DevNull (does nothing)
  • JSON (logs JSON messages to Stdout by default)
  • Syslog (logs messages to the local syslog facility)

Quick Start

To use the logging interface do

go get github.com/els0r/log/...

Example on how to use the package in your code

package main

import(
  log "github.com/els0r/log"
)

func main() {
  l := log.New(WithLevel(log.INFO))

  // Do someting

  l.Infof("We have done %d things today", 10)
  l.Error("This is an error")
}