log

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

Debug prints a debug-level log by default logger instance.

func Debugf

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

Debugf prints a debug-level log with format by default logger instance.

func Debugw

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

Debugw prints a debug-level log with json-format by default logger instance.

func Error

func Error(args ...interface{})

Error prints a error-level log by default logger instance.

func Errorf

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

Errorf prints a error-level log with format by default logger instance.

func Errorw

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

Errorw prints a error-level log with json-format by default logger instance.

func Fatal

func Fatal(args ...interface{})

Fatal prints a fatal-level log by default logger instance.

func Fatalf

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

Fatalf prints a fatal-level log with format by default logger instance.

func Fatalw

func Fatalw(msg string, kvs ...interface{})

Fatalw prints a fatal-level log with json-format by default logger instance.

func Info

func Info(args ...interface{})

Info prints a info-level log by default logger instance.

func Infof

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

Infof prints a info-level log with format by default logger instance.

func Infow

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

Infow prints a info-level log with json-format by default logger instance.

func Panic

func Panic(args ...interface{})

Panic prints a panic-level log by default logger instance.

func Panicf

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

Panicf prints a panic-level log with format by default logger instance.

func Panicw

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

Panicw prints a panicw-level log with json-format by default logger instance.

func SetDefault

func SetDefault(l *Logger)

SetDefault sets the default logger instance.

func Warn

func Warn(args ...interface{})

Warn prints a warn-level log by default logger instance.

func Warnf

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

Warnf prints a warn-level log with format by default logger instance.

func Warnw

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

Warnw prints a warn-level log with json-format by default logger instance.

Types

type Logger

type Logger struct {
	*zap.SugaredLogger
	// contains filtered or unexported fields
}

Logger wraps zap.SugaredLogger with two output cores: a rotate file and color console. It also registers a custom metrics collection hook.

func Default

func Default() *Logger

Default returns a default logger instance.

func New

func New(options ...Option) *Logger

New returns a Logger instance.

type Option

type Option func(*Logger)

Option configures a logger.

func WithConsoleLog

func WithConsoleLog(b bool) Option

WithConsoleLog returns a Option that sets the logger's consoleLog field. If consoleLog equals to true, the logger will output log to console.

func WithFileLog

func WithFileLog(b bool) Option

WithFileLog returns a Option that sets the logger's fileLog field. If fileLog equals to true, the logger will output log to file.

func WithFilePath

func WithFilePath(p string) Option

WithFilePath returns a Option that sets the logger's path field. path is file path of fileLog. It only takes effect when fileLog equals to true.

func WithLevel

func WithLevel(lvl string) Option

WithLevel returns a Option that sets the logger's level field.

Jump to

Keyboard shortcuts

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