logprinter

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

func Debugf(format string, args ...any)

Debugf output the debug message to console

func Errorf

func Errorf(format string, args ...any)

Errorf output the error message to console Deprecated: Use zap.L().Error() instead

func Infof

func Infof(format string, args ...any)

Infof output the log message to console Deprecated: Use zap.L().Info() instead

func SetDisplayMode

func SetDisplayMode(m DisplayMode)

SetDisplayMode changes the global output format of logger

func SetDisplayModeFromString

func SetDisplayModeFromString(m string)

SetDisplayModeFromString changes the global output format of logger

func SetStderr

func SetStderr(w io.Writer)

SetStderr redirect stderr to a custom writer

func SetStdout

func SetStdout(w io.Writer)

SetStdout redirect stdout to a custom writer

func Verbose

func Verbose(format string, args ...any)

Verbose logs verbose messages

func Warnf

func Warnf(format string, args ...any)

Warnf output the warning message to console Deprecated: Use zap.L().Warn() instead

Types

type ContextKey

type ContextKey string

ContextKey is key used to store values in context

const ContextKeyLogger ContextKey = "logger"

ContextKeyLogger is the key used for logger stored in context

type DisplayMode

type DisplayMode int

DisplayMode control the output format

const (
	DisplayModeDefault DisplayMode = iota // default is the interactive output
	DisplayModePlain                      // plain text
	DisplayModeJSON                       // JSON
)

display modes

func GetDisplayMode

func GetDisplayMode() DisplayMode

GetDisplayMode returns the current global output format

type Logger

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

Logger is a set of fuctions writing output to custom writters, but still using the global zap logger as our default config does not writes everything to a memory buffer. TODO: use also separate zap loggers

func NewLogger

func NewLogger(m string) *Logger

NewLogger creates a Logger with default settings

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...any)

Debugf output the debug message to console

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...any)

Errorf output the error message to console

func (*Logger) GetDisplayMode

func (l *Logger) GetDisplayMode() DisplayMode

GetDisplayMode returns the current output format

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...any)

Infof output the log message to console

func (*Logger) SetDisplayMode

func (l *Logger) SetDisplayMode(m DisplayMode)

SetDisplayMode changes the output format of logger

func (*Logger) SetDisplayModeFromString

func (l *Logger) SetDisplayModeFromString(m string)

SetDisplayModeFromString changes the output format of logger

func (*Logger) SetStderr

func (l *Logger) SetStderr(w io.Writer)

SetStderr redirect stderr to a custom writer

func (*Logger) SetStdout

func (l *Logger) SetStdout(w io.Writer)

SetStdout redirect stdout to a custom writer

func (*Logger) Verbose

func (l *Logger) Verbose(format string, args ...any)

Verbose logs verbose messages

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...any)

Warnf output the warning message to console

Jump to

Keyboard shortcuts

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