log

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 7 Imported by: 3

Documentation

Overview

Refer:

https://github.com/go-eden/slf4go
https://github.com/go-eden/slf4go-zap

Index

Constants

View Source
const (
	ModeSimple = "SIMPLE"
	ModeFull   = "FULL"
)

Variables

This section is empty.

Functions

func DPanic added in v0.10.6

func DPanic(args ...any)

DPanic uses fmt.Sprint to construct and log a message. In development, the logger then panics. (See DPanicLevel for details.)

func DPanicf added in v0.10.6

func DPanicf(template string, args ...any)

DPanicf uses fmt.Sprintf to log a templated message. In development, the logger then panics. (See DPanicLevel for details.)

func DPanicw added in v0.10.6

func DPanicw(msg string, keysAndValues ...any)

DPanicw logs a message with some additional context.

func Debug added in v0.10.6

func Debug(args ...any)

Debug uses fmt.Sprint to construct and log a message.

func Debugf added in v0.10.6

func Debugf(template string, args ...any)

Debugf uses fmt.Sprintf to log a templated message.

func Debugw added in v0.10.6

func Debugw(msg string, keysAndValues ...any)

Debugw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.

func Error added in v0.10.6

func Error(args ...any)

Error uses fmt.Sprint to construct and log a message.

func Errorf added in v0.10.6

func Errorf(template string, args ...any)

Errorf uses fmt.Sprintf to log a templated message.

func Errorw added in v0.10.6

func Errorw(msg string, keysAndValues ...any)

Errorw logs a message with some additional context.

func Fatal added in v0.10.6

func Fatal(args ...any)

Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.

func Fatalf added in v0.10.6

func Fatalf(template string, args ...any)

Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.

func Fatalw added in v0.10.6

func Fatalw(msg string, keysAndValues ...any)

Fatalw logs a message with some additional context.

func Info added in v0.10.6

func Info(args ...any)

Info uses fmt.Sprint to construct and log a message.

func Infof added in v0.10.6

func Infof(template string, args ...any)

Infof uses fmt.Sprintf to log a templated message.

func Infow added in v0.10.6

func Infow(msg string, keysAndValues ...any)

Infow logs a message with some additional context.

func Init

func Init(opts *Options) error

func Level added in v0.10.7

func Level() string

func Mode added in v0.10.6

func Mode() string

func Panic added in v0.10.6

func Panic(args ...any)

Panic uses fmt.Sprint to construct and log a message, then panics.

func Panicf added in v0.10.6

func Panicf(template string, args ...any)

Panicf uses fmt.Sprintf to log a templated message, then panics.

func Panicw added in v0.10.6

func Panicw(msg string, keysAndValues ...any)

Panicw logs a message with some additional context.

func SetDriver added in v0.10.6

func SetDriver(driver driver.Driver)

func Warn added in v0.10.6

func Warn(args ...any)

Warn uses fmt.Sprint to construct and log a message.

func Warnf added in v0.10.6

func Warnf(template string, args ...any)

Warnf uses fmt.Sprintf to log a templated message.

func Warnw added in v0.10.6

func Warnw(msg string, keysAndValues ...any)

Warnw logs a message with some additional context.

Types

type Logger added in v0.10.6

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

func (*Logger) DPanic added in v0.10.6

func (l *Logger) DPanic(args ...any)

func (*Logger) DPanicf added in v0.10.6

func (l *Logger) DPanicf(format string, args ...any)

func (*Logger) DPanicw added in v0.10.6

func (l *Logger) DPanicw(msg string, keysAndValues ...any)

DPanicw logs a message with some additional context.

func (*Logger) Debug added in v0.10.6

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

func (*Logger) Debugf added in v0.10.6

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

func (*Logger) Debugw added in v0.10.6

func (l *Logger) Debugw(msg string, keysAndValues ...any)

Debugw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.

func (*Logger) Error added in v0.10.6

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

func (*Logger) Errorf added in v0.10.6

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

func (*Logger) Errorw added in v0.10.6

func (l *Logger) Errorw(msg string, keysAndValues ...any)

Errorw logs a message with some additional context.

func (*Logger) Fatal added in v0.10.6

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

func (*Logger) Fatalf added in v0.10.6

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

func (*Logger) Fatalw added in v0.10.6

func (l *Logger) Fatalw(msg string, keysAndValues ...any)

Fatalw logs a message with some additional context.

func (*Logger) Info added in v0.10.6

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

func (*Logger) Infof added in v0.10.6

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

func (*Logger) Infow added in v0.10.6

func (l *Logger) Infow(msg string, keysAndValues ...any)

Infow logs a message with some additional context.

func (*Logger) Panic added in v0.10.6

func (l *Logger) Panic(args ...any)

func (*Logger) Panicf added in v0.10.6

func (l *Logger) Panicf(format string, args ...any)

func (*Logger) Panicw added in v0.10.6

func (l *Logger) Panicw(msg string, keysAndValues ...any)

Panicw logs a message with some additional context.

func (*Logger) Warn added in v0.10.6

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

func (*Logger) Warnf added in v0.10.6

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

func (*Logger) Warnw added in v0.10.6

func (l *Logger) Warnw(msg string, keysAndValues ...any)

Warnw logs a message with some additional context.

type LoggerIface added in v0.10.6

type LoggerIface interface {
	// Debug uses fmt.Sprint to construct and log a message.
	Debug(args ...any)

	// Info uses fmt.Sprint to construct and log a message.
	Info(args ...any)

	// Warn uses fmt.Sprint to construct and log a message.
	Warn(args ...any)

	// Error uses fmt.Sprint to construct and log a message.
	Error(args ...any)

	// DPanic uses fmt.Sprint to construct and log a message. In development, the
	// logger then panics. (See DPanicLevel for details.)
	DPanic(args ...any)

	// Panic uses fmt.Sprint to construct and log a message, then panics.
	Panic(args ...any)

	// Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
	Fatal(args ...any)

	// Debugf uses fmt.Sprintf to log a templated message.
	Debugf(format string, args ...any)

	// Infof uses fmt.Sprintf to log a templated message.
	Infof(format string, args ...any)

	// Warnf uses fmt.Sprintf to log a templated message.
	Warnf(format string, args ...any)

	// Errorf uses fmt.Sprintf to log a templated message.
	Errorf(format string, args ...any)

	// DPanicf uses fmt.Sprintf to log a templated message. In development, the
	// logger then panics. (See DPanicLevel for details.)
	DPanicf(format string, args ...any)

	// Panicf uses fmt.Sprintf to log a templated message, then panics.
	Panicf(format string, args ...any)

	// Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.
	Fatalf(format string, args ...any)
}

type Options added in v0.10.6

type Options struct {
	// Log mode: SIMPLE, FULL.
	//
	// Default: "FULL".
	Mode string
	// Log level: DEBUG, INFO, WARN, ERROR.
	//
	// Default: "INFO".
	Level string
	// Log filename: set this if you want to write log messages to files.
	//
	// Default: "".
	Filename string
	// Log sink: CONSOLE, FILE, and MULTI.
	//
	// Default: "CONSOLE".
	Sink string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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