logger

package
v0.0.0-...-ef650cd Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 16 Imported by: 6

Documentation

Index

Constants

View Source
const (
	FlagLevelName   = "logger-level"
	FlagConsoleName = "logger-console"
	FlagRetainName  = "logger-retain"
)

Variables

This section is empty.

Functions

func ClearMemoryLog

func ClearMemoryLog()

ClearMemoryLog clear the whole memory logs.

func Close

func Close()

Close the logger and recover the stdout and stderr

func CloseCatchStdout

func CloseCatchStdout()

CloseCatchStdout close the goroutine with the catching stdout task.

func Debug

func Debug(ctx context.Context, kvPairs ...interface{})

func DebugFlag

func DebugFlag() bool

DebugFlag returns true when debug level is opening.

func Debugf

func Debugf(ctx context.Context, format string, params ...interface{})

func Error

func Error(ctx context.Context, alarmType string, kvPairs ...interface{})

func Errorf

func Errorf(ctx context.Context, alarmType string, format string, params ...interface{})

func Flush

func Flush()

Flush logs to the output when using async logger.

func GetMemoryLogCount

func GetMemoryLogCount() int

GetMemoryLogCount returns the stored logs count, but only store the recently maxLines items.

func Info

func Info(ctx context.Context, kvPairs ...interface{})

func Infof

func Infof(ctx context.Context, format string, params ...interface{})

func Init

func Init()

func InitTestLogger

func InitTestLogger(options ...ConfigOption)

func OptionAsyncLogger

func OptionAsyncLogger()

func OptionDebugLevel

func OptionDebugLevel()

func OptionErrorLevel

func OptionErrorLevel()

func OptionInfoLevel

func OptionInfoLevel()

func OptionOffConsole

func OptionOffConsole()

func OptionOffMemoryReceiver

func OptionOffMemoryReceiver()

func OptionOpenConsole

func OptionOpenConsole()

func OptionOpenMemoryReceiver

func OptionOpenMemoryReceiver()

func OptionOverrideConfig

func OptionOverrideConfig()

func OptionRetainConfig

func OptionRetainConfig()

func OptionSyncLogger

func OptionSyncLogger()

func OptionWarnLevel

func OptionWarnLevel()

func ReadMemoryLog

func ReadMemoryLog(line int) (msg string, ok bool)

ReadMemoryLog get log when MemoryWriter working.

func Warning

func Warning(ctx context.Context, alarmType string, kvPairs ...interface{})

func Warningf

func Warningf(ctx context.Context, alarmType string, format string, params ...interface{})

Types

type ConfigOption

type ConfigOption func()

type MemoryWriter

type MemoryWriter struct {
}

MemoryWriter provide a easy way to check log in testing.

func (*MemoryWriter) AfterParse

func (m *MemoryWriter) AfterParse(initArgs seelog.CustomReceiverInitArgs) error

func (*MemoryWriter) Close

func (m *MemoryWriter) Close() error

func (*MemoryWriter) Flush

func (m *MemoryWriter) Flush()

func (*MemoryWriter) ReceiveMessage

func (m *MemoryWriter) ReceiveMessage(message string, level seelog.LogLevel, context seelog.LogContextInterface) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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