log

package module
v0.0.0-...-ba6ae98 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2017 License: MIT Imports: 4 Imported by: 21

README

Structured logger

Bare minimum structured logger.

  • Logs in JSON.
  • 3 log levels: info, error, fatal.
  • Reusable context logging
ll := log.KV("who", "world")
ll.Info("hello?")

if err := doThing(); err != nil {
    ll.Err(err).Error("this thing failed")
}
ll.KV("why", "no reason").Fatal("abort abort abort!")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(msg string)

func Fatal

func Fatal(msg string)

func Info

func Info(msg string)

Types

type Log

type Log struct {
	// contains filtered or unexported fields
}

func Err

func Err(err error) *Log

func KV

func KV(k string, v interface{}) *Log

func (*Log) Err

func (l *Log) Err(err error) *Log

func (*Log) Error

func (l *Log) Error(msg string)

func (*Log) Fatal

func (l *Log) Fatal(msg string)

func (*Log) Info

func (l *Log) Info(msg string)

func (*Log) KV

func (l *Log) KV(k string, v interface{}) *Log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL