log

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: Apache-2.0 Imports: 11 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddESHook

func AddESHook(level logrus.Level, urls ...string)

AddESHook AddESHook

func Debug

func Debug(ctx context.Context, args ...interface{})

Debug show log without format

func Debugf

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

Debugf show log with format

func Debugln

func Debugln(ctx context.Context, args ...interface{})

Debugln show log without format with line(CLCF)

func Error

func Error(ctx context.Context, args ...interface{})

Error show log without format

func Errorf

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

Errorf show log with format

func Errorln

func Errorln(ctx context.Context, args ...interface{})

Errorln show log without format with line(CLCF)

func Fatal

func Fatal(ctx context.Context, args ...interface{})

Fatal show log without format

func Fatalf

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

Fatalf show log with format

func Fatalln

func Fatalln(ctx context.Context, args ...interface{})

Fatalln show log without format with line(CLCF)

func GetCurLevel

func GetCurLevel() logrus.Level

GetCurLevel (Alias Name Of Level() func) return result from Level()

func GetLocalIP

func GetLocalIP() (string, error)

GetLocalIP get local private ip

func Info

func Info(ctx context.Context, args ...interface{})

Info show log without format

func Infof

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

Infof show log with format

func Infoln

func Infoln(ctx context.Context, args ...interface{})

Infoln show log without format with line(CLCF)

func IsDebugLevel

func IsDebugLevel() bool

IsDebugLevel Returen is debug mode or not

func IsLogLevel

func IsLogLevel(level int) bool

IsLogLevel Returen is <level> mode or not

func Level

func Level() logrus.Level

Level return current log level

func Panic

func Panic(ctx context.Context, args ...interface{})

Panic show log without format

func Panicf

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

Panicf show log with format

func Panicln

func Panicln(ctx context.Context, args ...interface{})

Panicln show log without format with line(CLCF)

func Print

func Print(ctx context.Context, args ...interface{})

Print show log without format

func Printf

func Printf(ctx context.Context, format string, args ...interface{})

Printf show log with format

func Println

func Println(ctx context.Context, args ...interface{})

Println show log without format with line(CLCF)

func SetLevel

func SetLevel(level logrus.Level)

SetLevel 优先于环境变量 环境变量名LOGGER_LEVEL,5=Debug 4=Info,3=Warn,2=Error,1=Fatal,0=Panic

func SetServiceName

func SetServiceName(serviceName string)

SetServiceName 优先于环境变量 环境变量名LOGGER_SERVICENAME

func UseJSONFormatter

func UseJSONFormatter()

UseJSONFormatter 优先于环境变量

func UseTextFormatter

func UseTextFormatter()

UseTextFormatter 优先于环境变量

func Warn

func Warn(ctx context.Context, args ...interface{})

Warn show log without format

func Warnf

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

Warnf show log with format

func Warning

func Warning(ctx context.Context, args ...interface{})

Warning show log without format

func Warningf

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

Warningf show log with format

func Warningln

func Warningln(ctx context.Context, args ...interface{})

Warningln show log without format with line(CLCF)

func Warnln

func Warnln(ctx context.Context, args ...interface{})

Warnln show log without format with line(CLCF)

Types

type ILogger

type ILogger interface {
	GetCurLevel() logrus.Level
	SetLevel(level logrus.Level)
	Level() logrus.Level
}

ILogger Interface for Logger

type Logger

type Logger struct {
	ServiceName string
	IP          string
	// contains filtered or unexported fields
}

Logger 环境变量名LOGGER_FORMATTER,只能设置两个值:json、text TODO back log :watch level change TODO back log :static TODO review code: log TODO load config from envirement

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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