# README
logutil
Utils for use with zerolog
Quick start
Setup logger with console writer (human readable)
logutil.SetupLogger(true)
Log new error with stack trace
err := errors.Errorf("testing")
// Msg must be empty string, if specified it overrides the error message
log.Error().Stack().Err(err).Msg("")
Add stack trace to an existing error
err := errors.WithStack(err)
When logging to json a stack trace will also be included
Multiple writers
Setup additional writers like this, see examples in log_test.go
logutil.SetupLogger(true, w1, w2)
Testing
Run all tests
cd ${GOPATH}/src/github.com/mozey/logutil
gotest -v ./...
# Functions
DefaultConsoleWriter creates a new ConsoleWriter with default settings.
LogToFile only.
MarshalStack implements pkg/errors stack trace marshaling.
NewConsoleWriter creates and initializes a new ConsoleWriter.
No description provided by the author
SetDefaults as recommended by this package.
SetNoColor overrides the default set in the init func.
SetupLogger sets up logging using zerolog.
# Variables
TruncFunc can be used to truncate the stack trace from the specified func.
# Structs
ConsoleWriter parses the JSON input and writes it in an (optionally) colorized, human-friendly format to Out.
# Type aliases
Formatter transforms the input into a formatted string.