log

package
v0.0.0-...-1f4ee57 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Stack     = "stack"
	Interface = "interface"
	Source    = "source"
	Result    = "result"
	Param     = "param"
	Func      = "func"
	Position  = "position"
	TraceId   = "traceId"
	SpanId    = "spanId"
	Type      = "type"
)

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

func Debugf

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

func Error

func Error(args ...interface{})

func Errorf

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

func Fatal

func Fatal(args ...interface{})

func Fatalf

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

func FromContext

func FromContext(ctx context.Context) (string, bool)

FromContext returns the User value stored in ctx, if any.

func Info

func Info(args ...interface{})

func Infof

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

func NewContext

func NewContext(ctx context.Context) context.Context

NewContext returns a new Context that carries value u.

func Panic

func Panic(args ...interface{})

func Panicf

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

func Print

func Print(args ...interface{})

func Printf

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

func Sync

func Sync()

func Warn

func Warn(args ...interface{})

func Warnf

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

Types

type Config

type Config struct {
	Development bool
	Caller      bool
	Level       zapcore.Level
	OutputPaths map[string][]string
	ModuleName  string //系统名称namespace.service
}

func (*Config) NewLogger

func (lf *Config) NewLogger() *Logger

初始化日志对象

func (*Config) SetLogger

func (lf *Config) SetLogger()

type IdKey

type IdKey struct{}

type KibanaField

type KibanaField struct {
	Id          string `json:"id"`
	Interface   string `json:"interface"`
	Method      string `json:"method"`
	Param       string `json:"param"`
	Other       string `json:"other"`
	ProcessTime string `json:"processTime"`
	Result      string `json:"result"`
}

type Log

type Log interface {
}

type Logger

type Logger struct {
	*zap.Logger
}
var (
	Default *Logger
)

func (*Logger) DPanic

func (l *Logger) DPanic(args ...interface{})

DPanic uses fmt.Sprint to construct and log a message. In development, the logger then panics. (See DPanicLevel for details.)

func (*Logger) DPanicf

func (l *Logger) DPanicf(template string, args ...interface{})

DPanicf uses fmt.Sprintf to log a templated message. In development, the logger then panics. (See DPanicLevel for details.)

func (*Logger) DPanicw

func (l *Logger) DPanicw(msg string, fields ...zap.Field)

DPanic logs a message at DPanicLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

If the logger is in development mode, it then panics (DPanic means "development panic"). This is useful for catching errors that are recoverable, but shouldn't ever happen.

func (*Logger) Debug

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

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

func (*Logger) Debugf

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

Debugf uses fmt.Sprintf to log a templated message.

func (*Logger) Debugw

func (l *Logger) Debugw(msg string, fields ...zap.Field)

Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Logger) Error

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

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

func (*Logger) Errorf

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

Errorf uses fmt.Sprintf to log a templated message.

func (*Logger) Errorln

func (l *Logger) Errorln(args ...interface{})

func (*Logger) Errorw

func (l *Logger) Errorw(msg string, fields ...zap.Field)

Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Logger) Fatal

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

Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.

func (*Logger) Fatalf

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

Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.

func (*Logger) Fatalln

func (l *Logger) Fatalln(args ...interface{})

func (*Logger) Fatalw

func (l *Logger) Fatalw(msg string, fields ...zap.Field)

Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

The logger then calls os.Exit(1), even if logging at FatalLevel is disabled.

func (*Logger) Info

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

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

func (*Logger) Infof

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

Infof uses fmt.Sprintf to log a templated message.

func (*Logger) Infoln

func (l *Logger) Infoln(args ...interface{})

兼容grpclog

func (*Logger) Infow

func (l *Logger) Infow(msg string, fields ...zap.Field)

Info logs a message at InfoLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Logger) Named

func (l *Logger) Named(name string) *Logger

Named adds a sub-scope to the logger's name. See Logger.Named for details.

func (*Logger) Panic

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

Panic uses fmt.Sprint to construct and log a message, then panics.

func (*Logger) Panicf

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

Panicf uses fmt.Sprintf to log a templated message, then panics.

func (*Logger) Panicw

func (l *Logger) Panicw(msg string, fields ...zap.Field)

Panic logs a message at PanicLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

The logger then panics, even if logging at PanicLevel is disabled.

func (*Logger) Print

func (l *Logger) Print(args ...interface{})

兼容gormv1

func (*Logger) Printf

func (l *Logger) Printf(template string, args ...interface{})

func (*Logger) Sugar

func (l *Logger) Sugar() *zap.SugaredLogger

func (*Logger) V

func (l *Logger) V(level int) bool

grpclog

func (*Logger) Warn

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

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

func (*Logger) Warnf

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

Warnf uses fmt.Sprintf to log a templated message.

func (*Logger) Warning

func (l *Logger) Warning(args ...interface{})

func (*Logger) Warningf

func (l *Logger) Warningf(template string, args ...interface{})

func (*Logger) Warningln

func (l *Logger) Warningln(args ...interface{})

func (*Logger) Warnw

func (l *Logger) Warnw(msg string, fields ...zap.Field)

Warn logs a message at WarnLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Logger) With

func (l *Logger) With(fields ...zap.Field) *Logger

func (*Logger) WithOptions

func (l *Logger) WithOptions(opts ...zap.Option) *Logger

type TalkHook

type TalkHook struct {
	AcceptedLevels []zapcore.Level
	BotURL         string
	AtPhoneArr     []string //填写在atMobiles中的@ 手机号
	AtPhoneStr     string   //填写在text中的@ 手机号
}

func (*TalkHook) FormatLog

func (th *TalkHook) FormatLog(e *zapcore.Entry) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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