Documentation ¶
Index ¶
- Constants
- func BuildConfig(opts ...LogOption) zap.Config
- func New(level string, devMode bool) (logr.Logger, error)
- func NewFromConfig(cfg zap.Config) (logr.Logger, error)
- type LogOption
- func WithDevelopment() LogOption
- func WithDisableStackTrace() LogOption
- func WithEncoding(e string) LogOption
- func WithHumanTimeCode() LogOption
- func WithLogLevel(l zapcore.Level) LogOption
- func WithMode(devMode bool) LogOption
- func WithOutAndErrPaths(o, e string) LogOption
- func WithProduction() LogOption
- func WithSampling(i, t int) LogOption
Constants ¶
const ( // LogLevelDebug = -1 LogLevelDebug int = -int(zap.DebugLevel) // LogLevelInfo = 0 LogLevelInfo int = -int(zap.InfoLevel) // LogLevelWarn = 1 LogLevelWarn int = -int(zap.WarnLevel) // LogLevelError = 2 LogLevelError int = -int(zap.ErrorLevel) )
Levels can be used with log.V() to temporarily reset the configured Level Levels are in order of decreasing verbosity and increasing importance
const (
DefaultLogLevel = "info"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LogOption ¶
LogOption is an option which can be applied to the Logger Config
func WithDevelopment ¶
func WithDevelopment() LogOption
WithDevelopment sets some Development mode defaults
func WithDisableStackTrace ¶
func WithDisableStackTrace() LogOption
WithDisableStackTrace disables the stack traces printed out with Error and Warn levels
func WithEncoding ¶
WithEncoding sets the encoding for the logger (eg "console" or "json"
func WithHumanTimeCode ¶
func WithHumanTimeCode() LogOption
WithHumanTimeCode can be used to set more human readable time on Production logs
func WithLogLevel ¶
WithLogLevel will set the log level on the Logger Config
func WithOutAndErrPaths ¶
WithOutAndErrPaths appends locations for stdout and stderr. This can be called as often as needed
func WithProduction ¶
func WithProduction() LogOption
WithProduction sets some Production mode defaults