jolt

package module
v0.0.0-...-1d17ab9 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: MIT Imports: 11 Imported by: 4

README

jolt

Build Status GoDoc Go Report Card codecov

Jolt is a simple logging package for Go. The goal is to provide ease-of-use over customization and performance.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Location

func Location() func() string

Location logs the source file and line number of the Logger.Print caller.

If the error is wrapped by github.com/pkg/errors then then the source file and line number will be based upon when the original error was wrapped.

func Package

func Package() func() string

Package logs the package name with each call to Logger.Print.

Types

type Fields

type Fields map[string]interface{}

Fields represents key/value pairs and will be JSON encoded when passed to Logger.Print.

type Logger

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

A Logger provides simple, user-friendly and thread-safe logging.

func DefaultLogger

func DefaultLogger(w ...io.Writer) *Logger

DefaultLogger constructs a new *jolt.Logger with the following defaults:

ts     current UTC time (RFC3339)
loc    the source file and line number of the caller

func New

func New(w ...io.Writer) *Logger

New initializes a new *jolt.Logger. By default, If no writers are provided os.Stderr is used.

func (*Logger) Print

func (j *Logger) Print(args ...interface{}) error

func (*Logger) With

func (j *Logger) With(m Fields) *Logger

With allows default Fields to be set. If a field is specified it will be in every invocation of Logger.Print.

Jump to

Keyboard shortcuts

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