Versions in this module Expand all Collapse all v0 v0.19.4 May 24, 2023 Changes in this version + const CRITICAL + const DEFAULT + const LUTC + const Ldate + const Ldefault + const Lfuncname + const Lgopid + const Llevel + const Llevelinitial + const Llongfile + const Lmedfile + const Lmicroseconds + const Lshortfile + const Lshortfuncname + const LstdFlags + const Ltime + var CanColorStderr = true + var CanColorStdout = true + func ColorBytes(attrs ...ColorAttribute) []byte + func Critical(format string, v ...any) + func Debug(format string, v ...any) + func Error(format string, v ...any) + func ErrorWithSkip(skip int, format string, v ...any) + func EventFormatTextMessage(mode *WriterMode, event *Event, msgFormat string, msgArgs ...any) []byte + func FallbackErrorf(format string, args ...any) + func Fatal(format string, v ...any) + func HasEventWriter(writerType string) bool + func Info(format string, v ...any) + func IsDebug() bool + func IsLoggerEnabled(name string) bool + func IsTrace() bool + func Log(skip int, level Level, format string, v ...any) + func LoggerToWriter(logf func(format string, args ...any)) io.Writer + func RegisterEventWriter(writerType string, p EventWriterProvider) + func SetConsoleLogger(loggerName, writerName string, level Level) + func Stack(skip int) string + func Trace(format string, v ...any) + func Warn(format string, v ...any) + type BaseLogger interface + GetLevel func() Level + Log func(skip int, level Level, format string, v ...any) + type ColorAttribute int + const BgBlack + const BgBlue + const BgCyan + const BgGreen + const BgHiBlack + const BgHiBlue + const BgHiCyan + const BgHiGreen + const BgHiMagenta + const BgHiRed + const BgHiWhite + const BgHiYellow + const BgMagenta + const BgRed + const BgWhite + const BgYellow + const BlinkRapid + const BlinkSlow + const Bold + const Concealed + const CrossedOut + const Faint + const FgBlack + const FgBlue + const FgCyan + const FgGreen + const FgHiBlack + const FgHiBlue + const FgHiCyan + const FgHiGreen + const FgHiMagenta + const FgHiRed + const FgHiWhite + const FgHiYellow + const FgMagenta + const FgRed + const FgWhite + const FgYellow + const Italic + const Reset + const ReverseVideo + const Underline + type ColoredValue struct + func ColoredMethod(method string) *ColoredValue + func ColoredStatus(status int, s ...string) *ColoredValue + func ColoredTime(duration time.Duration) *ColoredValue + func NewColoredValue(v any, color ...ColorAttribute) *ColoredValue + func (c *ColoredValue) Format(f fmt.State, verb rune) + type Event struct + Caller string + Filename string + GoroutinePid string + Level Level + Line int + MsgSimpleText string + Stacktrace string + Time time.Time + type EventFormatted struct + Msg any + Origin *Event + type EventFormatter func(mode *WriterMode, event *Event, msgFormat string, msgArgs ...any) []byte + type EventWriter interface + func NewEventWriter(name, writerType string, mode WriterMode) (EventWriter, error) + func NewEventWriterConn(writerName string, writerMode WriterMode) EventWriter + func NewEventWriterConsole(name string, mode WriterMode) EventWriter + func NewEventWriterFile(name string, mode WriterMode) EventWriter + type EventWriterBase interface + Base func() *EventWriterBaseImpl + GetLevel func() Level + GetWriterName func() string + GetWriterType func() string + Run func(ctx context.Context) + type EventWriterBaseImpl struct + FormatMessage EventFormatter + GetPauseChan func() chan struct{} + Mode *WriterMode + Name string + OutputWriteCloser io.WriteCloser + Queue chan *EventFormatted + func NewEventWriterBase(name, writerType string, mode WriterMode) *EventWriterBaseImpl + func (b *EventWriterBaseImpl) Base() *EventWriterBaseImpl + func (b *EventWriterBaseImpl) GetLevel() Level + func (b *EventWriterBaseImpl) GetWriterName() string + func (b *EventWriterBaseImpl) GetWriterType() string + func (b *EventWriterBaseImpl) Run(ctx context.Context) + type EventWriterProvider func(writerName string, writerMode WriterMode) EventWriter + type Flags struct + func FlagsFromBits(flags uint32) Flags + func FlagsFromString(from string, def ...uint32) Flags + func (f *Flags) UnmarshalJSON(bytes []byte) error + func (f Flags) Bits() uint32 + func (f Flags) MarshalJSON() ([]byte, error) + func (f Flags) String() string + type Level int + const DEBUG + const ERROR + const FATAL + const INFO + const NONE + const TRACE + const UNDEFINED + const WARN + func GetLevel() Level + func LevelFromString(level string) Level + func (l *Level) UnmarshalJSON(b []byte) error + func (l Level) ColorAttributes() []ColorAttribute + func (l Level) MarshalJSON() ([]byte, error) + func (l Level) String() string + type LevelLogger interface + Critical func(format string, v ...any) + Debug func(format string, v ...any) + Error func(format string, v ...any) + Info func(format string, v ...any) + LevelEnabled func(level Level) bool + Trace func(format string, v ...any) + Warn func(format string, v ...any) + type LogStringer interface + LogString func() string + type Logger interface + func BaseLoggerToGeneralLogger(b BaseLogger) Logger + func GetLogger(name string) Logger + type LoggerImpl struct + func NewLoggerWithWriters(ctx context.Context, writer ...EventWriter) *LoggerImpl + func (l *LoggerImpl) AddWriters(writer ...EventWriter) + func (l *LoggerImpl) Close() + func (l *LoggerImpl) DumpWriters() map[string]any + func (l *LoggerImpl) GetLevel() Level + func (l *LoggerImpl) IsEnabled() bool + func (l *LoggerImpl) Log(skip int, level Level, format string, logArgs ...any) + func (l *LoggerImpl) RemoveAllWriters() *LoggerImpl + func (l *LoggerImpl) RemoveWriter(modeName string) error + func (l *LoggerImpl) SendLogEvent(event *Event) + type LoggerManager struct + func GetManager() *LoggerManager + func NewManager() *LoggerManager + func (m *LoggerManager) Close() + func (m *LoggerManager) DumpLoggers() map[string]any + func (m *LoggerManager) GetLogger(name string) *LoggerImpl + func (m *LoggerManager) GetPauseChan() chan struct{} + func (m *LoggerManager) GetSharedWriter(writerName string) EventWriter + func (m *LoggerManager) NewSharedWriter(writerName, writerType string, mode WriterMode) (writer EventWriter, err error) + func (m *LoggerManager) PauseAll() + func (m *LoggerManager) ResumeAll() + type PrintfLogger struct + Logf func(format string, args ...any) + func (p *PrintfLogger) Printf(format string, args ...any) + type WriterConnOption struct + Addr string + Protocol string + Reconnect bool + ReconnectOnMsg bool + type WriterConsoleOption struct + Stderr bool + type WriterFileOption struct + Compress bool + CompressionLevel int + DailyRotate bool + FileName string + LogRotate bool + MaxDays int + MaxSize int64 + type WriterMode struct + BufferLen int + Colorize bool + Expression string + Flags Flags + Level Level + Prefix string + StacktraceLevel Level + WriterOption any