Categorygithub.com/corestoreio/log
modulepackage
4.1.0+incompatible
Repository: https://github.com/corestoreio/log.git
Documentation: pkg.go.dev

# README

log

Package log contains a minimal Logger interface and structured logging based on the idea of uber-go/zap.

It also provides wrapper to favorite log libraries like log15, standard lib log and uber-go/zap.

Min. Go Version: 1.9

Read the package documentation for more information.

Contributing

Please have a look at the contribution guidelines.

Acknowledgements

Some packages have been fully refactored but the initial idea has been extracted from the geniuses listed below:

NamePackageLicense
Uber Technologies, Inc.logCopyright (c) 2016 MIT License

Licensing

CoreStore is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Copyright

Cyrill Schumacher - PGP Key

# Packages

Package log15w provides a wrapper (w) to github.com/inconshreveable/log15.
Package logapex provides a wrapper for github.com/apex/log TODO Apex provides Handlers to: cli – human-friendly CLI output, discard – discards all logs, es – Elasticsearch handler, graylog – Graylog handler, json – JSON output handler, kinesis – AWS Kinesis handler, level – level filter handler, logfmt – logfmt plain-text formatter, memory – in-memory handler for tests, multi – fan-out to multiple handlers, papertrail – Papertrail handler, text – human-friendly colored output and delta – outputs the delta between log calls and spinner.
Package loghttp creates log fields for http Requests and Responses.
Package logmem logs periodically or now the memory consumption if there are changes above a specific threshold.
Package logtest provides a testing.TB compatible logger for debugging purposes.
Package logw provides a wrapper (w) to Go's standard logger.
Package logzero provides a wrapper (w) to github.com/rs/zerolog.
Package zapw provides a wrapper (w) to github.com/uber-go/zap.

# Functions

Bool constructs a Field with the given key and value.
Duration constructs a Field with the given key and value.
Err constructs a Field that stores err under the key log.ErrorKeyName.
ErrWithKey constructs a Field that stores err under a key.
Float64 constructs a Field with the given key and value.
GoStringer constructs a Field with the given key and value.
Int constructs a Field with the given key and value.
Int64 constructs a Field with the given key and value.
Int64s constructs a Field with the given key and multiple values.
Ints constructs a Field with the given key and multiple values.
JSON constructs a Field with the given key and value.
Marshal constructs a field with the given key and log.Marshaler.
Nest takes a key and a variadic number of Fields and creates a nested namespace.
Object constructs a field with the given key and an arbitrary object.
ObjectTypeOf logs the type of the `val` interface.
String constructs a Field with the given key and value.
Stringer constructs a Field with the given key and value.
StringFn constructs a Field with the given key and a closure to the AddStringFn.
Strings constructs a Field with the given key and multiple values.
Text constructs a Field with the given key and value.
Time constructs a Field with the given key and value.
Uint constructs a Field with the given key and value.
Uint64 constructs a Field with the given key and value.
UnixNanoHuman converts a unix nano value using the format string "2006-01-02 15:04:05.999999999 -0700 MST".
WhenDone returns a Logger which tracks the duration.

# Constants

KeyNameDuration defines the name of the duration field logging with the struct type "Deferred".
KeyNameError whenever an error occurs during marshaling this value defines the official key name in the log stream.

# Variables

AssignmentChar represents the assignment character between key-value pairs.
Now returns the current time including a monotonic time part.
Separator is the separator to use between key value pairs.

# Structs

BlackHole logs and does nothing.
Deferred defines a logger type which can be used to trace the duration.
MutexBuffer allows concurrent and parallel writes to a buffer.
WriteTypes satisfies the interface KeyValuer.

# Interfaces

Field is a deferred marshaling operation used to add a key-value pair to a logger's context.
KeyValuer is an encoding-agnostic interface to add structured data to the logging context.
Logger defines the minimum requirements for logging.
Marshaler allows user-defined types to efficiently add themselves to the logging context, and to selectively omit information which shouldn't be included in logs (e.g., passwords).

# Type aliases

AddStringFn same as KeyValuer.AddString to allow creating 3rd party log packages which can log very different types for which we do not want to create a Marshaler.
Fields a slice of n Field types.