gxylog

package
v0.0.0-...-7e69858 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DebugLevel logs are typically voluminous, and are usually disabled in
	// production.
	DebugLevel = zap.DebugLevel
	// InfoLevel is the default logging priority.
	InfoLevel = zap.InfoLevel
	// WarnLevel logs are more important than Info, but don't need individual
	// human review.
	WarnLevel = zap.WarnLevel
	// ErrorLevel logs are high-priority. If an application is running smoothly,
	// it shouldn't generate any error-Level logs.
	ErrorLevel = zap.ErrorLevel
	// PanicLevel logs a message, then panics.
	PanicLevel = zap.PanicLevel
	// FatalLevel logs a message, then calls os.Exit(1).
	FatalLevel = zap.FatalLevel
)

Variables

View Source
var (
	// String alias for zap.String
	String = zap.String
	// Any alias for zap.Any
	Any = zap.Any
	// Int64 alias for zap.Int64
	Int64 = zap.Int64
	// Int alias for zap.Int
	Int = zap.Int
	// Int32 alias for zap.Int32
	Int32 = zap.Int32
	// Uint alias for zap.Uint
	Uint = zap.Uint
	// Duration alias for zap.Duration
	Duration = zap.Duration
	// Durationp alias for zap.Duration
	Durationp = zap.Durationp
	// Object alias for zap.Object
	Object = zap.Object
	// Namespace alias for zap.Namespace
	Namespace = zap.Namespace
	// Reflect alias for zap.Reflect
	Reflect = zap.Reflect
	// Skip alias for zap.Skip()
	Skip = zap.Skip()
	// ByteString alias for zap.ByteString
	ByteString = zap.ByteString
)

Functions

func DPanic

func DPanic(msg string, fields ...Field)

DPanic ...

func DPanicf

func DPanicf(msg string, args ...interface{})

DPanicf ...

func DPanicw

func DPanicw(msg string, keysAndValues ...interface{})

DPanicw ...

func Debug

func Debug(msg string, fields ...Field)

Debug ...

func Debugf

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

Debugf ...

func Debugw

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

Debugw ...

func DefaultConfig

func DefaultConfig() *config

func Error

func Error(msg string, fields ...Field)

Error ...

func Errorf

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

Errorf ...

func Errorw

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

Errorw ...

func Fatal

func Fatal(msg string, fields ...Field)

Fatal ...

func Fatalf

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

Fatalf ...

func Fatalw

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

Fatalw ...

func Info

func Info(msg string, fields ...Field)

Info ...

func Infof

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

Infof ...

func Infow

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

Infow ...

func Panic

func Panic(msg string, fields ...Field)

Panic ...

func Panicf

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

Panicf ...

func Panicw

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

Panicw ...

func SetDefaultLogger

func SetDefaultLogger(l *GalaxyLog)

func Warn

func Warn(msg string, fields ...Field)

Warn ...

func Warnf

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

Warnf ...

func Warnw

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

Warnw ...

Types

type Field

type Field = zap.Field

Field ...

func FieldAddr

func FieldAddr(value string) Field

FieldAddr 设置地址

func FieldApp

func FieldApp(value string) Field

FieldApp 设置应用名

func FieldCode

func FieldCode(value int32) Field

FieldCode ...

func FieldComponent

func FieldComponent(value string) Field

FieldComponent 设置组件

func FieldComponentName

func FieldComponentName(value string) Field

FieldComponentName 设置组件配置名

func FieldCost

func FieldCost(value time.Duration) Field

FieldCost 耗时时间

func FieldCustomKeyValue

func FieldCustomKeyValue(key string, value string) Field

FieldCustomKeyValue 设置自定义日志

func FieldDescription

func FieldDescription(value string) Field

FieldDescription ...

func FieldErr

func FieldErr(err error) Field

FieldErr ...

func FieldErrAny

func FieldErrAny(err interface{}) Field

FieldErrAny ...

func FieldErrKind

func FieldErrKind(value string) Field

FieldErrKind ...

func FieldEvent

func FieldEvent(value string) Field

FieldEvent ...

func FieldExtMessage

func FieldExtMessage(vals ...interface{}) Field

FieldExtMessage ...

func FieldIP

func FieldIP(value string) Field

FieldIP ...

func FieldKey

func FieldKey(value string) Field

FieldKey ...

func FieldKind

func FieldKind(value string) Field

FieldKind ... level 2

func FieldMethod

func FieldMethod(value string) Field

FieldMethod ...

func FieldName

func FieldName(value string) Field

FieldName ...

func FieldPeerIP

func FieldPeerIP(value string) Field

FieldPeerIP ...

func FieldPeerName

func FieldPeerName(value string) Field

FieldPeerName ...

func FieldSize

func FieldSize(value int32) Field

FieldSize ...

func FieldStack

func FieldStack(value []byte) Field

FieldStack ...

func FieldTid

func FieldTid(value string) Field

FieldTid 设置链路id

func FieldType

func FieldType(value string) Field

FieldType ... level 1

func FieldValue

func FieldValue(value string) Field

FieldValue ...

func FieldValueAny

func FieldValueAny(value interface{}) Field

FieldValueAny ...

type GalaxyLog

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

func DefaultLogger

func DefaultLogger() *GalaxyLog

func NewLogger

func NewLogger(name string, configure *gxyconfig.Configuration, opts ...Option) *GalaxyLog

func With

func With(fields ...Field) *GalaxyLog

With ...

func (*GalaxyLog) AutoLevel

func (g *GalaxyLog) AutoLevel(c *gxyconfig.Configuration)

AutoLevel ...

func (*GalaxyLog) DPanic

func (g *GalaxyLog) DPanic(msg string, fields ...Field)

DPanic ...

func (*GalaxyLog) DPanicf

func (g *GalaxyLog) DPanicf(template string, args ...interface{})

DPanicf ...

func (*GalaxyLog) DPanicw

func (g *GalaxyLog) DPanicw(msg string, keysAndValues ...interface{})

DPanicw ...

func (*GalaxyLog) Debug

func (g *GalaxyLog) Debug(msg string, fields ...Field)

Debug ...

func (*GalaxyLog) Debugf

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

Debugf ...

func (*GalaxyLog) Debugw

func (g *GalaxyLog) Debugw(msg string, keysAndValues ...interface{})

Debugw ...

func (*GalaxyLog) Error

func (g *GalaxyLog) Error(msg string, fields ...Field)

Error ...

func (*GalaxyLog) Errorf

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

Errorf ...

func (*GalaxyLog) Errorw

func (g *GalaxyLog) Errorw(msg string, keysAndValues ...interface{})

Errorw ...

func (*GalaxyLog) Fatal

func (g *GalaxyLog) Fatal(msg string, fields ...Field)

Fatal ...

func (*GalaxyLog) Fatalf

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

Fatalf ...

func (*GalaxyLog) Fatalw

func (g *GalaxyLog) Fatalw(msg string, keysAndValues ...interface{})

Fatalw ...

func (*GalaxyLog) Flush

func (g *GalaxyLog) Flush() error

Flush ... When use os.Stdout or os.Stderr as zapcore.WriteSyncer g.desugar.Sync() maybe return an error like this: 'sync /dev/stdout: The handle is invalid.' Because os.Stdout and os.Stderr is a non-normal file, maybe not support 'fsync' in different os platform So ignored Sync() return value About issues: https://github.com/uber-go/zap/issues/328 About 'fsync': https://man7.org/linux/man-pages/man2/fsync.2.html

func (*GalaxyLog) Info

func (g *GalaxyLog) Info(msg string, fields ...Field)

Info ...

func (*GalaxyLog) Infof

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

Infof ...

func (*GalaxyLog) Infow

func (g *GalaxyLog) Infow(msg string, keysAndValues ...interface{})

Infow ...

func (*GalaxyLog) Panic

func (g *GalaxyLog) Panic(msg string, fields ...Field)

Panic ...

func (*GalaxyLog) Panicf

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

Panicf ...

func (*GalaxyLog) Panicw

func (g *GalaxyLog) Panicw(msg string, keysAndValues ...interface{})

Panicw ...

func (*GalaxyLog) SetLevel

func (g *GalaxyLog) SetLevel(lv Level)

SetLevel ...

func (*GalaxyLog) StdLog

func (g *GalaxyLog) StdLog() *log.Logger

StdLog ...

func (*GalaxyLog) Warn

func (g *GalaxyLog) Warn(msg string, fields ...Field)

Warn ...

func (*GalaxyLog) Warnf

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

Warnf ...

func (*GalaxyLog) Warnw

func (g *GalaxyLog) Warnw(msg string, keysAndValues ...interface{})

Warnw ...

func (*GalaxyLog) With

func (g *GalaxyLog) With(fields ...Field) *GalaxyLog

With ...

func (*GalaxyLog) WithCallerSkip

func (g *GalaxyLog) WithCallerSkip(callerSkip int, fields ...Field) *GalaxyLog

WithCallerSkip ...

type Level

type Level = zapcore.Level

Level ...

type Option

type Option func(g *GalaxyLog)

Option 可选项

func WithEnableAddCaller

func WithEnableAddCaller(enableAddCaller bool) Option

WithEnableAddCaller 是否添加行号,默认不添加行号

func WithLevel

func WithLevel(level string) Option

WithDebug 设置在命令行显示 WithLevel 设置级别

func WithName

func WithName(name string) Option

func WithZapCore

func WithZapCore(core zapcore.Core) Option

WithZapCore 添加ZapCore

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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