golog

package
v0.0.1-0...-1514542 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// FatalPrefix show fatal prefix
	FatalPrefix = Prefix{
		Plain: plainFatal,
		Color: colorful.Red(plainFatal),
		File:  true,
	}

	// ErrorPrefix show error prefix
	ErrorPrefix = Prefix{
		Plain: plainError,
		Color: colorful.Red(plainError),
		File:  true,
	}

	// WarnPrefix show warn prefix
	WarnPrefix = Prefix{
		Plain: plainWarn,
		Color: colorful.Orange(plainWarn),
	}

	// InfoPrefix show info prefix
	InfoPrefix = Prefix{
		Plain: plainInfo,
		Color: colorful.Green(plainInfo),
	}

	// DebugPrefix show info prefix
	DebugPrefix = Prefix{
		Plain: plainDebug,
		Color: colorful.Purple(plainDebug),
		File:  true,
	}

	// TracePrefix show info prefix
	TracePrefix = Prefix{
		Plain: plainTrace,
		Color: colorful.Cyan(plainTrace),
	}
)

Functions

This section is empty.

Types

type FdWriter

type FdWriter interface {
	io.Writer
	Fd() uintptr
}

FdWriter interface extends existing io.Writer with file descriptor function support

type Logger

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

Logger struct define the underlying storage for single logger

func New

func New(out FdWriter) *Logger

New returns new Logger instance with predefined writer output and automatically detect terminal coloring support

func (*Logger) Debug

func (l *Logger) Debug(v ...any)

Debug print debug message to output if debug output enabled

func (*Logger) Debugf

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

Debugf print formatted debug message to output if debug output enabled

func (*Logger) Error

func (l *Logger) Error(v ...any)

Error print error message to output

func (*Logger) Errorf

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

Errorf print formatted error message to output

func (*Logger) Fatal

func (l *Logger) Fatal(v ...any)

Fatal print fatal message to output and quit the application with status 1

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...any)

Fatalf print formatted fatal message to output and quit the application with status 1

func (*Logger) Info

func (l *Logger) Info(v ...any)

Info print informational message to output

func (*Logger) Infof

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

Infof print formatted informational message to output

func (*Logger) IsDebug

func (l *Logger) IsDebug() bool

IsDebug check the state of debugging output

func (*Logger) IsQuiet

func (l *Logger) IsQuiet() bool

IsQuiet check for quiet state

func (*Logger) NoQuiet

func (l *Logger) NoQuiet() *Logger

NoQuiet turn on all log output

func (*Logger) Output

func (l *Logger) Output(depth int, prefix Prefix, data string) error

Output print the actual value

func (*Logger) Quiet

func (l *Logger) Quiet() *Logger

Quiet turn off all log output

func (*Logger) SetLogLevel

func (l *Logger) SetLogLevel(level log.LogLevel)

func (*Logger) SetOutput

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

func (*Logger) Trace

func (l *Logger) Trace(v ...any)

Trace print trace message to output if debug output enabled

func (*Logger) Tracef

func (l *Logger) Tracef(format string, v ...any)

Tracef print formatted trace message to output if debug output enabled

func (*Logger) Warn

func (l *Logger) Warn(v ...any)

Warn print warning message to output

func (*Logger) Warnf

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

Warnf print formatted warning message to output

func (*Logger) WithColor

func (l *Logger) WithColor() *Logger

WithColor explicitly turn on colorful features on the log

func (*Logger) WithDebug

func (l *Logger) WithDebug() *Logger

WithDebug turn on debugging output on the log to reveal debug and trace level

func (*Logger) WithTimestamp

func (l *Logger) WithTimestamp() *Logger

WithTimestamp turn on timestamp output on the log

func (*Logger) WithoutColor

func (l *Logger) WithoutColor() *Logger

WithoutColor explicitly turn off colorful features on the log

func (*Logger) WithoutDebug

func (l *Logger) WithoutDebug() *Logger

WithoutDebug turn off debugging output on the log

func (*Logger) WithoutTimestamp

func (l *Logger) WithoutTimestamp() *Logger

WithoutTimestamp turn off timestamp output on the log

type Prefix

type Prefix struct {
	Plain []byte
	Color []byte
	File  bool
}

Prefix struct define plain and color byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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