golog

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: GPL-3.0 Imports: 11 Imported by: 1

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 ...interface{})

Debug print debug message to output if debug output enabled

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

Debugf print formatted debug message to output if debug output enabled

func (*Logger) Error

func (l *Logger) Error(v ...interface{})

Error print error message to output

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

Errorf print formatted error message to output

func (*Logger) Fatal

func (l *Logger) Fatal(v ...interface{})

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

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...interface{})

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

func (*Logger) Info

func (l *Logger) Info(v ...interface{})

Info print informational message to output

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

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 added in v0.4.2

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

func (*Logger) Trace

func (l *Logger) Trace(v ...interface{})

Trace print trace message to output if debug output enabled

func (*Logger) Tracef

func (l *Logger) Tracef(format string, v ...interface{})

Tracef print formatted trace message to output if debug output enabled

func (*Logger) Warn

func (l *Logger) Warn(v ...interface{})

Warn print warning message to output

func (*Logger) Warnf

func (l *Logger) Warnf(format string, v ...interface{})

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