logger

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 4 Imported by: 10

Documentation

Index

Constants

View Source
const LOG_LEVEL_ALL int = 0
View Source
const LOG_LEVEL_INFO int = 1
View Source
const LOG_LEVEL_NONE int = 3
View Source
const LOG_LEVEL_WARN int = 2

Variables

View Source
var NilLogger = &nilLogger{}

Functions

This section is empty.

Types

type ColorLogger

type ColorLogger struct {
	Verbose bool
	Level   int
	Prefix  string
	Color   bool
}

ColorLogger - A Logger that logs to stdout in color

func (*ColorLogger) Debug

func (logger *ColorLogger) Debug(format string, args ...interface{})

Debug - Log a debug message

func (*ColorLogger) Error

func (logger *ColorLogger) Error(format string, args ...interface{})

Error - Log a error

func (*ColorLogger) GetLevel

func (logger *ColorLogger) GetLevel() int

Warn - no-op

func (*ColorLogger) Info

func (logger *ColorLogger) Info(format string, args ...interface{})

Info - Log a general message

func (*ColorLogger) Trace

func (logger *ColorLogger) Trace(format string, args ...interface{})

Trace - Log a very verbose trace message

func (*ColorLogger) Warn

func (logger *ColorLogger) Warn(format string, args ...interface{})

Warn - Log a warning

type DefaultLogger

type DefaultLogger ColorLogger

DefaultLogger - Default monocolor logger.

type Func

type Func func() string

Func Function wrapper that support lazy evaluation for the logger

func NewFormatFunc added in v1.3.3

func NewFormatFunc(f func(msg string, arg ...interface{}) string, msg string, args ...interface{}) Func

NewFormatFunc Create the function wrapper that compatible with fmt.Sprintf

func NewFunc

func NewFunc(f Func) Func

NewFunc Create the function wrapper for func() string

func NewFuncWithArg

func NewFuncWithArg(f func(arg interface{}) string, arg interface{}) Func

NewFuncWithArg Create the function wrapper for func(arg interface{}) string

func NewFuncWithArgs

func NewFuncWithArgs(f func(arg ...interface{}) string, args ...interface{}) Func

NewFuncWithArgs Create the function wrapper for func(arg ...interface{}) string

func (Func) String

func (f Func) String() string

type Logger

type Logger interface {
	Trace(format string, args ...interface{})
	Debug(format string, args ...interface{})
	Info(format string, args ...interface{})
	Warn(format string, args ...interface{})
	Error(format string, args ...interface{})
	GetLevel() int
}

Logger - Interface to pass into Proxy for it to log messages

Jump to

Keyboard shortcuts

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