log

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 7 Imported by: 12

README

log

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultLogFileConfig = &lumberjack.Logger{
		Filename:   filepath.Join(basePath, logFileName),
		MaxSize:    10,
		MaxBackups: 5,
		MaxAge:     28,
		LocalTime:  true,
	}
)

Functions

func Debug added in v0.0.7

func Debug(msg ...string)

func Debugf added in v0.0.7

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

func Error added in v0.0.7

func Error(msg ...string)

func Errorf added in v0.0.7

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

func Info added in v0.0.7

func Info(msg ...string)

func Infof added in v0.0.7

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

func SetLogger added in v0.0.7

func SetLogger(l *Logger)

func Warning added in v0.0.7

func Warning(msg ...string)

func Warningf added in v0.0.7

func Warningf(format string, args ...interface{})

Types

type LogFormat

type LogFormat string
const (
	JSON    LogFormat = "json"
	CONSOLE LogFormat = "console"
)

type LogLevel

type LogLevel int
const (
	DEBUG LogLevel = iota
	INFO
	WARNING
	ERROR
	FATAL
)

type LogOption added in v0.0.9

type LogOption func(*Logger)

func WithCallerSkip added in v0.0.9

func WithCallerSkip(skips int) LogOption

type Logger

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

func NewLogger

func NewLogger(opts ...LogOption) *Logger

func (*Logger) Debug

func (l *Logger) Debug(msg ...string)

func (*Logger) Debugf added in v0.0.3

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

func (*Logger) Error

func (l *Logger) Error(msg ...string)

func (*Logger) Errorf added in v0.0.3

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

func (*Logger) Fatal added in v0.0.4

func (l *Logger) Fatal(msg ...string)

func (*Logger) Fatalf added in v0.0.4

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

func (*Logger) Info

func (l *Logger) Info(msg ...string)

func (*Logger) Infof added in v0.0.3

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

func (*Logger) Warning

func (l *Logger) Warning(msg ...string)

func (*Logger) Warningf added in v0.0.3

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

type LoggerConfig

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

func NewConfig

func NewConfig() *LoggerConfig

func (*LoggerConfig) Build

func (l *LoggerConfig) Build() *Logger

func (*LoggerConfig) Format

func (l *LoggerConfig) Format(format LogFormat) *LoggerConfig

func (*LoggerConfig) Level

func (l *LoggerConfig) Level(level LogLevel) *LoggerConfig

func (*LoggerConfig) Rotate

func (l *LoggerConfig) Rotate(opts ...Option) *LoggerConfig

type Option

type Option func(*LoggerConfig)

func WithComstomLogConfig

func WithComstomLogConfig(fileName string, MaxSize int, MaxAge int) Option

Jump to

Keyboard shortcuts

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