log

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 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 ...interface{})

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

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

DPanicw logs a message with some additional context.

func Debug added in v0.10.6

func Debug(args ...interface{})

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

func Debugf added in v0.10.6

func Debugf(template string, args ...interface{})

Debugf uses fmt.Sprintf to log a templated message.

func Debugw added in v0.10.6

func Debugw(msg string, keysAndValues ...interface{})

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

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

func Errorf added in v0.10.6

func Errorf(template string, args ...interface{})

Errorf uses fmt.Sprintf to log a templated message.

func Errorw added in v0.10.6

func Errorw(msg string, keysAndValues ...interface{})

Errorw logs a message with some additional context.

func Fatal added in v0.10.6

func Fatal(args ...interface{})

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

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

Fatalw logs a message with some additional context.

func Info added in v0.10.6

func Info(args ...interface{})

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

func Infof added in v0.10.6

func Infof(template string, args ...interface{})

Infof uses fmt.Sprintf to log a templated message.

func Infow added in v0.10.6

func Infow(msg string, keysAndValues ...interface{})

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

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

func Panicf added in v0.10.6

func Panicf(template string, args ...interface{})

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

func Panicw added in v0.10.6

func Panicw(msg string, keysAndValues ...interface{})

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

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

func Warnf added in v0.10.6

func Warnf(template string, args ...interface{})

Warnf uses fmt.Sprintf to log a templated message.

func Warnw added in v0.10.6

func Warnw(msg string, keysAndValues ...interface{})

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

func (*Logger) DPanicf added in v0.10.6

func (l *Logger) DPanicf(format string, args ...interface{})

func (*Logger) DPanicw added in v0.10.6

func (l *Logger) DPanicw(msg string, keysAndValues ...interface{})

DPanicw logs a message with some additional context.

func (*Logger) Debug added in v0.10.6

func (l *Logger) Debug(args ...interface{})

func (*Logger) Debugf added in v0.10.6

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

func (*Logger) Debugw added in v0.10.6

func (l *Logger) Debugw(msg string, keysAndValues ...interface{})

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

func (*Logger) Errorf added in v0.10.6

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

func (*Logger) Errorw added in v0.10.6

func (l *Logger) Errorw(msg string, keysAndValues ...interface{})

Errorw logs a message with some additional context.

func (*Logger) Fatal added in v0.10.6

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

func (*Logger) Fatalf added in v0.10.6

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

func (*Logger) Fatalw added in v0.10.6

func (l *Logger) Fatalw(msg string, keysAndValues ...interface{})

Fatalw logs a message with some additional context.

func (*Logger) Info added in v0.10.6

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

func (*Logger) Infof added in v0.10.6

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

func (*Logger) Infow added in v0.10.6

func (l *Logger) Infow(msg string, keysAndValues ...interface{})

Infow logs a message with some additional context.

func (*Logger) Panic added in v0.10.6

func (l *Logger) Panic(args ...interface{})

func (*Logger) Panicf added in v0.10.6

func (l *Logger) Panicf(format string, args ...interface{})

func (*Logger) Panicw added in v0.10.6

func (l *Logger) Panicw(msg string, keysAndValues ...interface{})

Panicw logs a message with some additional context.

func (*Logger) Warn added in v0.10.6

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

func (*Logger) Warnf added in v0.10.6

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

func (*Logger) Warnw added in v0.10.6

func (l *Logger) Warnw(msg string, keysAndValues ...interface{})

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

	// Info uses fmt.Sprint to construct and log a message.
	Info(args ...interface{})

	// Warn uses fmt.Sprint to construct and log a message.
	Warn(args ...interface{})

	// Error uses fmt.Sprint to construct and log a message.
	Error(args ...interface{})

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

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

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

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

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

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

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

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

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

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

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