Categorygithub.com/coveooss/multilogger
modulepackage
0.6.0
Repository: https://github.com/coveooss/multilogger.git
Documentation: pkg.go.dev

# README

multilogger

Multilogger is a small logging wrapper based on logrus that writes logs simultaneously to the console, files or any other hook. Each of those logging methods can be given a different logging level. It exposes the same API as a regular logrus logger.

See multilogger godoc for full documentation.

multicolor

There is also a sub package used to handle colors and attributes. It is based on color which is an archived project but still useful.

See multicolor godoc for full documentation.

# Packages

Package multicolor is a complement to github.com/fatih/color.
No description provided by the author
No description provided by the author

# Functions

AcceptedLevels returns all accepted logrus levels.
AcceptedLevelsString returns all accepted logrus levels as a comma-separated string.
GetDurationFunc returns a function that can be used to format a duration.
GetGlobalFileFormat returns the currently globally set file log format.
GetGlobalFormat returns the currently globally set console log format.
New creates a new Multilogger instance.
NewConsoleHook creates a new hook to log information to console (default to stderr).
NewFileHook creates a new hook to log information into a file.
NewFormatter creates a new formatter with color setting and takes the first defined format string as the log format.
NewHook generates a named hook wrapper that is able the handle its own logging level.
ParseBool returns true for any value that is set and is not clearly a false.
ParseLogLevel converts a string or number into a logging level.
SetDurationFormat globally set the duration format preferences (across executables).
SetDurationPrecision allows duration to be rounded up to the desired precision (globally set across executables).
SetGlobalFileFormat configure the default format used for file logging and ensure that it is available for all applications by setting an environment variable.
SetGlobalFormat configure the default format used for console logging and ensure that it is available for all applications by setting an environment variable.
TryGetDurationFunc returns a function that can be used to format a duration.
TryParseLogLevel converts a string or number into a logging level.

# Constants

CallerEnvVar is an environment variable that enable the caller stack by default.
ClassicFormat formats durations with higher units such as days, months, years, but use floating value bellow minutes as native golang format does.
DefaultConsoleFormat is the format used by NewConsoleHook if MULTILOGGER_FORMAT is not set.
DefaultFileFormat is the format used by NewFileHook if neither MULTILOGGER_FORMAT or MULTILOGGER_FILE_FORMAT are set.
DisabledLevel can be set when one of the logging hooks should be disabled.
FormatEnvVar is an environment variable that allows users to set the default format used for log entry.
FormatFileEnvVar is an environment variable that allows users to set the default format used for log entry using a file logger.
NativeFormat formats durations using the native golang duration format.
PreciseFormat formats durations with precise unit for each segment 1d2h3m4s5ms6µs.

# Structs

Formatter implements logrus.Formatter interface.
Hook represents a hook that logs at a given level.
Logger represents a logger that logs to both a file and the console at different (configurable) levels.

# Type aliases

DurationFormat represents the representation of a duration rendering format.
DurationFunc is the prototype used to represent a duration format function.