nlog

package
v0.0.0-...-3388463 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 5 Imported by: 110

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

func Debugf

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

func Error

func Error(args ...interface{})

func Errorf

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

func Fatal

func Fatal(args ...interface{})

func Fatalf

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

func Info

func Info(args ...interface{})

func Infof

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

func Setup

func Setup(ops ...Option)

func Sync

func Sync() error

func Warn

func Warn(args ...interface{})

func Warnf

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

func Write

func Write(p []byte) (int, error)

Types

type Formatter

type Formatter interface {
	Format(context.Context, string) string
}

func NewDefaultFormatter

func NewDefaultFormatter() Formatter

func NewGinLogFormatter

func NewGinLogFormatter() Formatter

type LogConfig

type LogConfig struct {
	LogLevel string
	LogPath  string

	// MaxFileSizeMB is the maximum size in megabytes of the log file before it gets
	// rotated. It defaults to 100 megabytes.
	MaxFileSizeMB int

	// MaxFiles is the maximum number of old log files to retain.  The default
	// is to retain all old log files
	MaxFiles int

	Compress bool
}

type LogWriter

type LogWriter interface {
	Infof(format string, args ...interface{})
	Info(args ...interface{})

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

	Warnf(format string, args ...interface{})
	Warn(args ...interface{})

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

	Fatalf(format string, args ...interface{})
	Fatal(args ...interface{})

	Sync() error
	Write(p []byte) (int, error)
}

func GetDefaultLogWriter

func GetDefaultLogWriter() LogWriter

type NLog

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

func DefaultLogger

func DefaultLogger() *NLog

func NewNLog

func NewNLog(ops ...Option) *NLog

func WithCtx

func WithCtx(ctx context.Context) *NLog

func (*NLog) Debug

func (n *NLog) Debug(args ...interface{})

func (*NLog) Debugf

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

func (*NLog) Error

func (n *NLog) Error(args ...interface{})

func (*NLog) Errorf

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

func (*NLog) Fatal

func (n *NLog) Fatal(args ...interface{})

func (*NLog) Fatalf

func (n *NLog) Fatalf(format string, args ...interface{})

func (*NLog) Info

func (n *NLog) Info(args ...interface{})

func (*NLog) Infof

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

func (*NLog) Warn

func (n *NLog) Warn(args ...interface{})

func (*NLog) Warnf

func (n *NLog) Warnf(format string, args ...interface{})

func (*NLog) WithCtx

func (n *NLog) WithCtx(ctx context.Context) *NLog

func (*NLog) Write

func (n *NLog) Write(p []byte) (int, error)

type Option

type Option interface {
	// contains filtered or unexported methods
}

func SetFormatter

func SetFormatter(f Formatter) Option

func SetWriter

func SetWriter(w LogWriter) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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