logger

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: LGPL-2.1 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Get = definePlugin.Get

Get 获取插件

View Source
var Name = definePlugin.Name

Name 插件名称

View Source
var TryGet = definePlugin.TryGet

TryGet 尝试获取插件

Functions

func DPanic

func DPanic(pluginResolver plugin.PluginResolver, v ...interface{})

DPanic logs a message at DPanicLevel, spaces are added between operands when neither is a string and a newline is appended.

func DPanicf

func DPanicf(pluginResolver plugin.PluginResolver, format string, v ...interface{})

DPanicf logs a formatted message at DPanicLevel.

func DPanicln

func DPanicln(pluginResolver plugin.PluginResolver, v ...interface{})

DPanicln logs a message at DPanicLevel, spaces are always added between operands and a newline is appended.

func Debug

func Debug(pluginResolver plugin.PluginResolver, v ...interface{})

Debug logs a message at DebugLevel, spaces are added between operands when neither is a string and a newline is appended.

func Debugf

func Debugf(pluginResolver plugin.PluginResolver, format string, v ...interface{})

Debugf logs a formatted message at DebugLevel.

func Debugln

func Debugln(pluginResolver plugin.PluginResolver, v ...interface{})

Debugln logs a message at DebugLevel, spaces are always added between operands and a newline is appended.

func Error

func Error(pluginResolver plugin.PluginResolver, v ...interface{})

Error logs a message at ErrorLevel, spaces are added between operands when neither is a string and a newline is appended.

func Errorf

func Errorf(pluginResolver plugin.PluginResolver, format string, v ...interface{})

Errorf logs a formatted message at ErrorLevel.

func Errorln

func Errorln(pluginResolver plugin.PluginResolver, v ...interface{})

Errorln logs a message at ErrorLevel, spaces are always added between operands and a newline is appended.

func Fatal

func Fatal(pluginResolver plugin.PluginResolver, v ...interface{})

Fatal logs a message at FatalLevel, spaces are added between operands when neither is a string and a newline is appended.

func Fatalf

func Fatalf(pluginResolver plugin.PluginResolver, format string, v ...interface{})

Fatalf logs a formatted message at FatalLevel.

func Fatalln

func Fatalln(pluginResolver plugin.PluginResolver, v ...interface{})

Fatalln logs a message at FatalLevel, spaces are always added between operands and a newline is appended.

func Info

func Info(pluginResolver plugin.PluginResolver, v ...interface{})

Info logs a message at InfoLevel, spaces are added between operands when neither is a string and a newline is appended.

func Infof

func Infof(pluginResolver plugin.PluginResolver, format string, v ...interface{})

Infof logs a formatted message at InfoLevel.

func Infoln

func Infoln(pluginResolver plugin.PluginResolver, v ...interface{})

Infoln logs a message at InfoLevel, spaces are always added between operands and a newline is appended.

func Panic

func Panic(pluginResolver plugin.PluginResolver, v ...interface{})

Panic logs a message at PanicLevel, spaces are added between operands when neither is a string and a newline is appended.

func Panicf

func Panicf(pluginResolver plugin.PluginResolver, format string, v ...interface{})

Panicf logs a formatted message at PanicLevel.

func Panicln

func Panicln(pluginResolver plugin.PluginResolver, v ...interface{})

Panicln logs a message at PanicLevel, spaces are always added between operands and a newline is appended.

func Trace

func Trace(pluginResolver plugin.PluginResolver, v ...interface{})

Trace logs a message at TraceLevel, spaces are added between operands when neither is a string and a newline is appended.

func Tracef

func Tracef(pluginResolver plugin.PluginResolver, format string, v ...interface{})

Tracef logs a formatted message at TraceLevel.

func Traceln

func Traceln(pluginResolver plugin.PluginResolver, v ...interface{})

Traceln logs a message at TraceLevel, spaces are always added between operands and a newline is appended.

func Warn

func Warn(pluginResolver plugin.PluginResolver, v ...interface{})

Warn logs a message at WarnLevel, spaces are added between operands when neither is a string and a newline is appended.

func Warnf

func Warnf(pluginResolver plugin.PluginResolver, format string, v ...interface{})

Warnf logs a formatted message at WarnLevel.

func Warnln

func Warnln(pluginResolver plugin.PluginResolver, v ...interface{})

Warnln logs a message at WarnLevel, spaces are always added between operands and a newline is appended.

Types

type Level

type Level int8

A Level is a logging priority. Higher levels are more important.

const (
	// TraceLevel level. Designates finer-grained informational events than the Debug.
	TraceLevel Level = iota
	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
	DebugLevel
	// InfoLevel is the default logging priority.
	// General operational entries about what's going on inside the application.
	InfoLevel
	// WarnLevel level. Non-critical entries that deserve eyes.
	WarnLevel
	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
	ErrorLevel
	// DPanicLevel level. Logs and call `panic()` in development mode.
	DPanicLevel
	// PanicLevel level. Logs and call `panic()`.
	PanicLevel
	// FatalLevel level. Logs and then calls `logger.Exit(1)`. highest level of severity.
	FatalLevel
)

func (Level) CapitalString added in v0.1.4

func (l Level) CapitalString() string

CapitalString returns an all-caps ASCII representation of the log level.

func (Level) Enabled

func (l Level) Enabled(level Level) bool

Enabled returns true if the given level is at or above this level.

func (Level) Get added in v0.1.4

func (l Level) Get() interface{}

Get gets the level for the flag.Getter interface.

func (Level) MarshalText added in v0.1.4

func (l Level) MarshalText() ([]byte, error)

MarshalText marshals the Level to text. Note that the text representation drops the -Level suffix (see example).

func (Level) PackSkip

func (l Level) PackSkip(skip int8) Level

PackSkip returns a new Level value with an additional skip offset encoded in the high bits. The skip value indicates the number of additional stack frames to skip before logging. It is useful for providing more contextual information in the log.

func (*Level) Set

func (l *Level) Set(str string) error

Set converts a level string into a logger Level value. returns error if the input string does not match known values.

func (Level) String

func (l Level) String() string

String returns a lower-case ASCII representation of the log level.

func (*Level) UnmarshalText added in v0.1.4

func (l *Level) UnmarshalText(text []byte) error

UnmarshalText unmarshals text to a level. Like MarshalText, UnmarshalText expects the text representation of a Level to drop the -Level suffix (see example).

In particular, this makes it easy to configure logging levels using YAML, TOML, or JSON files.

func (Level) UnpackSkip

func (l Level) UnpackSkip() (Level, int8)

UnpackSkip extracts the original Level value and the skip offset from a packed Level value. If the skip offset is not present in the packed value, a default value of 1 is used. It is useful for decoding the skip offset and recovering the original Level value.

type Logger

type Logger interface {
	// Log writes a log entry, spaces are added between operands when neither is a string and a newline is appended.
	Log(level Level, v ...interface{})
	// Logln writes a log entry, spaces are always added between operands and a newline is appended.
	Logln(level Level, v ...interface{})
	// Logf writes a formatted log entry.
	Logf(level Level, format string, v ...interface{})
}

Logger is a generic logging interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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