log

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 6 Imported by: 22

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

Debug uses the fmt.Sprint to construct and log a message using the DefaultLogger.

func Debugf

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

Debugf uses the fmt.Sprintf to log a templated message using the DefaultLogger.

func Debugw

func Debugw(message string, fields ...zapcore.Field)

Debugw logs a message with some additional context using the DefaultLogger.

func Error

func Error(args ...interface{})

Error uses the fmt.Sprint to construct and log a message using the DefaultLogger.

func Errorf

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

Errorf uses the fmt.Sprintf to log a templated message using the DefaultLogger.

func Errorw

func Errorw(message string, fields ...zapcore.Field)

Errorw logs a message with some additional context using the DefaultLogger.

func Fatal

func Fatal(args ...interface{})

Fatal uses the fmt.Sprint to construct and log a message using the DefaultLogger.

func Fatalf

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

Fatalf uses the fmt.Sprintf to log a templated message using the DefaultLogger.

func Fatalw

func Fatalw(message string, fields ...zapcore.Field)

Fatalw logs a message with some additional context using the DefaultLogger.

func Info

func Info(args ...interface{})

Info uses the fmt.Sprint to construct and log a message using the DefaultLogger.

func Infof

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

Infof uses the fmt.Sprintf to log a templated message using the DefaultLogger.

func Infow

func Infow(message string, fields ...zapcore.Field)

Infow logs a message with some additional context using the DefaultLogger.

func Panic

func Panic(args ...interface{})

Panic uses the fmt.Sprint to construct and log a message using the DefaultLogger.

func Panicf

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

Panicf uses the fmt.Sprintf to log a templated message using the DefaultLogger.

func Panicw

func Panicw(message string, fields ...zapcore.Field)

Panicw logs a message with some additional context using the DefaultLogger.

func Warn

func Warn(args ...interface{})

Warn uses the fmt.Sprint to construct and log a message using the DefaultLogger.

func Warnf

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

Warnf uses the fmt.Sprintf to log a templated message using the DefaultLogger.

func Warnw

func Warnw(message string, fields ...zapcore.Field)

Warnw logs a message with some additional context using the DefaultLogger.

Types

type Logger

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

Logger is a log object, which exposes standard APIs like errorf, error, warn, warnf and etcd.

var (
	// DefaultLogger is the default logger, which logs message to stderr and with
	// the minimal level "warn".
	DefaultLogger *Logger
)

func NewLogger

func NewLogger(opts ...Option) (*Logger, error)

NewLogger sets up a Logger object according to a series of options.

func SkipFrames added in v0.1.4

func SkipFrames(frames int) *Logger

func SkipFramesOnce added in v0.1.3

func SkipFramesOnce(frames int) *Logger

func (*Logger) Close

func (logger *Logger) Close() (err error)

Close flushes all buffered logs and closes the underlying writer.

func (*Logger) Debug

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

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

func (*Logger) Debugf

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

Debugf uses the fmt.Sprintf to log a templated message.

func (*Logger) Debugw

func (logger *Logger) Debugw(message string, fields ...zapcore.Field)

Debugw logs a message with some additional context.

func (*Logger) Error

func (logger *Logger) Error(args ...interface{})

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

func (*Logger) Errorf

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

Errorf uses the fmt.Sprintf to log a templated message.

func (*Logger) Errorw

func (logger *Logger) Errorw(message string, fields ...zapcore.Field)

Errorw logs a message with some additional context.

func (*Logger) Fatal

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

Fatal uses the fmt.Sprint to construct and log a message.

func (*Logger) Fatalf

func (logger *Logger) Fatalf(template string, args ...interface{})

Fatalf uses the fmt.Sprintf to log a templated message.

func (*Logger) Fatalw

func (logger *Logger) Fatalw(message string, fields ...zapcore.Field)

Fatalw logs a message with some additional context.

func (*Logger) Info

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

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

func (*Logger) Infof

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

Infof uses the fmt.Sprintf to log a templated message.

func (*Logger) Infow

func (logger *Logger) Infow(message string, fields ...zapcore.Field)

Infow logs a message with some additional context.

func (*Logger) Panic

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

Panic uses the fmt.Sprint to construct and log a message.

func (*Logger) Panicf

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

Panicf uses the fmt.Sprintf to log a templated message.

func (*Logger) Panicw

func (logger *Logger) Panicw(message string, fields ...zapcore.Field)

Panicw logs a message with some additional context.

func (*Logger) SkipFrames added in v0.1.4

func (logger *Logger) SkipFrames(frames int) *Logger

func (*Logger) SkipFramesOnce added in v0.1.3

func (logger *Logger) SkipFramesOnce(frames int) *Logger

func (*Logger) Sync

func (logger *Logger) Sync() (err error)

Sync flushes all buffered logs to the their destination.

func (*Logger) Warn

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

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

func (*Logger) Warnf

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

Warnf uses the fmt.Sprintf to log a templated message.

func (*Logger) Warnw

func (logger *Logger) Warnw(message string, fields ...zapcore.Field)

Warnw logs a message with some additional context.

type Option

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

Option configures how to set up logger.

func WithContext

func WithContext(ctx string) Option

WithContext sets the context of the logger.

func WithLogLevel

func WithLogLevel(level string) Option

WithLogLevel sets the log level.

func WithOutputFile

func WithOutputFile(file string) Option

WithOutputFile sets the output file path.

func WithSkipFrames added in v0.1.1

func WithSkipFrames(sf int) Option

WithSkipFrames sets the number frames that will be skipped when printing the file and line information.

func WithWriteSyncer

func WithWriteSyncer(ws zapcore.WriteSyncer) Option

WithWriteSyncer is a low level API which sets the underlying WriteSyncer by providing a zapcore.WriterSyncer, which has high priority than WithOutputFile.

Jump to

Keyboard shortcuts

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