logc

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelFatal = iota - 3
	LevelError
	LevelWarning
	LevelNormal
	LevelInfo
	LevelDebug
	LevelTrace
)
View Source
const (
	TraceLog = iota
	DebugLog
	InfoLog
	NormalLog
	WarnLog
	ErrorLog
	FatalLog
)

Variables

This section is empty.

Functions

func AppendPassphraseRegexp

func AppendPassphraseRegexp(re ...any) error

AppendPassphraseRegexp is used to append the regexps to match the tokens/passphrases you want to hide them in the log output. Here are two type supported, string and *regexp.Regexp.

func Debug

func Debug(msg ...any)

Debug print the message in the debug level

func Debugf

func Debugf(format string, msg ...any)

Debugf act like Debug but with format

func DontHideToken

func DontHideToken()

DontHideToken is used to un-hide the tokens within log message, the default behavior is hiding those tokens.

func Error

func Error(msg ...any)

Error print the message in the error level

func Errorf

func Errorf(format string, msg ...any)

Errorf act like Error but with format

func Fatal

func Fatal(msg ...any)

Fatal print the message in the fatal level, and exit the program

func Fatalf

func Fatalf(format string, msg ...any)

Fatalf act like Fatal but with format

func Info

func Info(msg ...any)

Info print the message in the info level

func Infof

func Infof(format string, msg ...any)

Infof act like Info but with format

func Log

func Log(msg ...any)

Log print the message in the Normal level

func Logf

func Logf(format string, msg ...any)

Logf act like Log but with format

func SetLogLevel

func SetLogLevel(level int)

SetLogLevel is used to set the log level, the default log level is LevelNormal

func SetOutput

func SetOutput(w io.Writer, index ...int)

SetOutput set the output of loggers in the default LogC instance specified by index, the index is optional, if no one provided, the all loggers will set the output to w.

func SetPrefix

func SetPrefix(prefix string)

SetPrefix is used to append a unique additional prefix to the current prefix.

func StderrTo

func StderrTo(w io.Writer)

StderrTo set the default stderr loggers to new writer.

func StdoutTo

func StdoutTo(w io.Writer)

StdoutTo set the default stdout loggers to new writer.

func Trace

func Trace(msg ...any)

Trace print the message in the trace level

func Tracef

func Tracef(format string, msg ...any)

Tracef act like Trace but with format

func Warn

func Warn(msg ...any)

Warn print the message in the warning level

func Warnf

func Warnf(format string, msg ...any)

Warnf act like Warn but with format

Types

type LogC

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

func Default

func Default() *LogC

func NewLogC

func NewLogC() *LogC

func (*LogC) AppendPassphraseRegexp

func (lc *LogC) AppendPassphraseRegexp(re ...any) error

AppendPassphraseRegexp is used to append the regexps to match the tokens/passphrases you want to hide them in the log output. Here are two type supported, string and *regexp.Regexp.

func (*LogC) Debug

func (lc *LogC) Debug(msg ...any)

Debug print the message in the debug level

func (*LogC) Debugf

func (lc *LogC) Debugf(format string, msg ...any)

Debugf act like Debug but with format

func (*LogC) DontHideToken

func (lc *LogC) DontHideToken()

DontHideToken is used to un-hide the tokens within log message, the default behavior is hiding those tokens.

func (*LogC) Error

func (lc *LogC) Error(msg ...any)

Error print the message in the error level

func (*LogC) Errorf

func (lc *LogC) Errorf(format string, msg ...any)

Errorf act like Error but with format

func (*LogC) Fatal

func (lc *LogC) Fatal(msg ...any)

Fatal print the message in the fatal level, and exit the program

func (*LogC) Fatalf

func (lc *LogC) Fatalf(format string, msg ...any)

Fatalf act like Fatal but with format

func (*LogC) Info

func (lc *LogC) Info(msg ...any)

Info print the message in the info level

func (*LogC) Infof

func (lc *LogC) Infof(format string, msg ...any)

Infof act like Info but with format

func (*LogC) Log

func (lc *LogC) Log(msg ...any)

Log print the message in the Normal level

func (*LogC) Logf

func (lc *LogC) Logf(format string, msg ...any)

Logf act like Log but with format

func (*LogC) SetLogLevel

func (lc *LogC) SetLogLevel(level int)

SetLogLevel is used to set the log level, the default log level is LevelNormal

func (*LogC) SetOutput

func (lc *LogC) SetOutput(w io.Writer, index ...int)

SetOutput set the output of loggers in this LogC instance specified by index, the index is optional, if no one provided, the all loggers will set the output to w.

func (*LogC) SetPrefix

func (lc *LogC) SetPrefix(prefix string)

SetPrefix is used to append a unique additional prefix to the current prefix.

func (*LogC) StderrTo

func (lc *LogC) StderrTo(w io.Writer)

StderrTo set the stderr loggers to the new writer.

func (*LogC) StdoutTo

func (lc *LogC) StdoutTo(w io.Writer)

StdoutTo set the stdout loggers to the new writer.

func (*LogC) Trace

func (lc *LogC) Trace(msg ...any)

Trace print the message in the trace level

func (*LogC) Tracef

func (lc *LogC) Tracef(format string, msg ...any)

Tracef act like Trace but with format

func (*LogC) Warn

func (lc *LogC) Warn(msg ...any)

Warn print the message in the warning level

func (*LogC) Warnf

func (lc *LogC) Warnf(format string, msg ...any)

Warnf act like Warn but with format

Jump to

Keyboard shortcuts

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