log

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

DefaultLogger is default logger.

View Source
var File_log_conf_proto protoreflect.FileDescriptor

Functions

func Debug

func Debug(a ...interface{})

Debug logs a message at debug level.

func Debugf

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

Debugf logs a message at debug level.

func Debugw

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

Debugw logs a message at debug level.

func Error

func Error(a ...interface{})

Error logs a message at error level.

func ErrorPanic

func ErrorPanic(err interface{})

ErrorPanic logs a message at error level.

func ErrorStack

func ErrorStack(err error)

ErrorStack logs a message at error level.

func Errorf

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

Errorf logs a message at error level.

func Errorw

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

Errorw logs a message at error level.

func Fatal

func Fatal(a ...interface{})

Fatal logs a message at fatal level.

func Fatalf

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

Fatalf logs a message at fatal level.

func Fatalw

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

Fatalw logs a message at fatal level.

func GetCore

func GetCore() zapcore.Core

func Info

func Info(a ...interface{})

Info logs a message at info level.

func Infof

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

Infof logs a message at info level.

func Infow

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

Infow logs a message at info level.

func Init

func Init(c *Conf) core.Logger

func NewLoggerCore

func NewLoggerCore(c *Conf) (core.Logger, error)

func SetLogger

func SetLogger(logger *ZapLogger)

SetLogger should be called before any other log call. And it is NOT THREAD SAFE.

func Warn

func Warn(a ...interface{})

Warn logs a message at warn level.

func Warnf

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

Warnf logs a message at warnf level.

func Warnw

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

Warnw logs a message at warnf level.

func With

func With(c zapcore.Core, kv ...interface{}) zapcore.Core

Types

type Conf

type Conf struct {
	Console *StdoutConf `protobuf:"bytes,1,opt,name=console,proto3" json:"console,omitempty"`
	File    *FileConf   `protobuf:"bytes,2,opt,name=file,proto3" json:"file,omitempty"`
	Fluent  *FluentConf `protobuf:"bytes,3,opt,name=fluent,proto3" json:"fluent,omitempty"`
	// contains filtered or unexported fields
}

func (*Conf) Descriptor deprecated

func (*Conf) Descriptor() ([]byte, []int)

Deprecated: Use Conf.ProtoReflect.Descriptor instead.

func (*Conf) GetConsole

func (x *Conf) GetConsole() *StdoutConf

func (*Conf) GetFile

func (x *Conf) GetFile() *FileConf

func (*Conf) GetFluent

func (x *Conf) GetFluent() *FluentConf

func (*Conf) ProtoMessage

func (*Conf) ProtoMessage()

func (*Conf) ProtoReflect

func (x *Conf) ProtoReflect() protoreflect.Message

func (*Conf) Reset

func (x *Conf) Reset()

func (*Conf) String

func (x *Conf) String() string

func (*Conf) Validate

func (m *Conf) Validate() error

Validate checks the field values on Conf with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type ConfValidationError

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

ConfValidationError is the validation error returned by Conf.Validate if the designated constraints aren't met.

func (ConfValidationError) Cause

func (e ConfValidationError) Cause() error

Cause function returns cause value.

func (ConfValidationError) Error

func (e ConfValidationError) Error() string

Error satisfies the builtin error interface

func (ConfValidationError) ErrorName

func (e ConfValidationError) ErrorName() string

ErrorName returns error name.

func (ConfValidationError) Field

func (e ConfValidationError) Field() string

Field function returns field value.

func (ConfValidationError) Key

func (e ConfValidationError) Key() bool

Key function returns key value.

func (ConfValidationError) Reason

func (e ConfValidationError) Reason() string

Reason function returns reason value.

type FileConf

type FileConf struct {
	Enable bool   `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"`
	Level  int32  `protobuf:"varint,2,opt,name=level,proto3" json:"level,omitempty"`
	Path   string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
	Name   string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*FileConf) Descriptor deprecated

func (*FileConf) Descriptor() ([]byte, []int)

Deprecated: Use FileConf.ProtoReflect.Descriptor instead.

func (*FileConf) GetEnable

func (x *FileConf) GetEnable() bool

func (*FileConf) GetLevel

func (x *FileConf) GetLevel() int32

func (*FileConf) GetName

func (x *FileConf) GetName() string

func (*FileConf) GetPath

func (x *FileConf) GetPath() string

func (*FileConf) ProtoMessage

func (*FileConf) ProtoMessage()

func (*FileConf) ProtoReflect

func (x *FileConf) ProtoReflect() protoreflect.Message

func (*FileConf) Reset

func (x *FileConf) Reset()

func (*FileConf) String

func (x *FileConf) String() string

func (*FileConf) Validate

func (m *FileConf) Validate() error

Validate checks the field values on FileConf with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type FileConfValidationError

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

FileConfValidationError is the validation error returned by FileConf.Validate if the designated constraints aren't met.

func (FileConfValidationError) Cause

func (e FileConfValidationError) Cause() error

Cause function returns cause value.

func (FileConfValidationError) Error

func (e FileConfValidationError) Error() string

Error satisfies the builtin error interface

func (FileConfValidationError) ErrorName

func (e FileConfValidationError) ErrorName() string

ErrorName returns error name.

func (FileConfValidationError) Field

func (e FileConfValidationError) Field() string

Field function returns field value.

func (FileConfValidationError) Key

func (e FileConfValidationError) Key() bool

Key function returns key value.

func (FileConfValidationError) Reason

func (e FileConfValidationError) Reason() string

Reason function returns reason value.

type FluentConf

type FluentConf struct {
	Enable bool   `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"`
	Level  int32  `protobuf:"varint,2,opt,name=level,proto3" json:"level,omitempty"`
	Addr   string `protobuf:"bytes,3,opt,name=addr,proto3" json:"addr,omitempty"`
	// contains filtered or unexported fields
}

func (*FluentConf) Descriptor deprecated

func (*FluentConf) Descriptor() ([]byte, []int)

Deprecated: Use FluentConf.ProtoReflect.Descriptor instead.

func (*FluentConf) GetAddr

func (x *FluentConf) GetAddr() string

func (*FluentConf) GetEnable

func (x *FluentConf) GetEnable() bool

func (*FluentConf) GetLevel

func (x *FluentConf) GetLevel() int32

func (*FluentConf) ProtoMessage

func (*FluentConf) ProtoMessage()

func (*FluentConf) ProtoReflect

func (x *FluentConf) ProtoReflect() protoreflect.Message

func (*FluentConf) Reset

func (x *FluentConf) Reset()

func (*FluentConf) String

func (x *FluentConf) String() string

func (*FluentConf) Validate

func (m *FluentConf) Validate() error

Validate checks the field values on FluentConf with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type FluentConfValidationError

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

FluentConfValidationError is the validation error returned by FluentConf.Validate if the designated constraints aren't met.

func (FluentConfValidationError) Cause

func (e FluentConfValidationError) Cause() error

Cause function returns cause value.

func (FluentConfValidationError) Error

Error satisfies the builtin error interface

func (FluentConfValidationError) ErrorName

func (e FluentConfValidationError) ErrorName() string

ErrorName returns error name.

func (FluentConfValidationError) Field

Field function returns field value.

func (FluentConfValidationError) Key

Key function returns key value.

func (FluentConfValidationError) Reason

func (e FluentConfValidationError) Reason() string

Reason function returns reason value.

type StdoutConf

type StdoutConf struct {
	Enable bool  `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"`
	Level  int32 `protobuf:"varint,2,opt,name=level,proto3" json:"level,omitempty"`
	// contains filtered or unexported fields
}

func (*StdoutConf) Descriptor deprecated

func (*StdoutConf) Descriptor() ([]byte, []int)

Deprecated: Use StdoutConf.ProtoReflect.Descriptor instead.

func (*StdoutConf) GetEnable

func (x *StdoutConf) GetEnable() bool

func (*StdoutConf) GetLevel

func (x *StdoutConf) GetLevel() int32

func (*StdoutConf) ProtoMessage

func (*StdoutConf) ProtoMessage()

func (*StdoutConf) ProtoReflect

func (x *StdoutConf) ProtoReflect() protoreflect.Message

func (*StdoutConf) Reset

func (x *StdoutConf) Reset()

func (*StdoutConf) String

func (x *StdoutConf) String() string

func (*StdoutConf) Validate

func (m *StdoutConf) Validate() error

Validate checks the field values on StdoutConf with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type StdoutConfValidationError

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

StdoutConfValidationError is the validation error returned by StdoutConf.Validate if the designated constraints aren't met.

func (StdoutConfValidationError) Cause

func (e StdoutConfValidationError) Cause() error

Cause function returns cause value.

func (StdoutConfValidationError) Error

Error satisfies the builtin error interface

func (StdoutConfValidationError) ErrorName

func (e StdoutConfValidationError) ErrorName() string

ErrorName returns error name.

func (StdoutConfValidationError) Field

Field function returns field value.

func (StdoutConfValidationError) Key

Key function returns key value.

func (StdoutConfValidationError) Reason

func (e StdoutConfValidationError) Reason() string

Reason function returns reason value.

type ZapLogger

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

func GetLogger

func GetLogger() *ZapLogger

GetLogger returns global logger appliance as logger in current process.

func NewLogger

func NewLogger(core zapcore.Core, n int) *ZapLogger

func NewZapLogger

func NewZapLogger(core zapcore.Core, n int) *ZapLogger

func (*ZapLogger) Debug

func (s *ZapLogger) Debug(a ...interface{})

Debug logs a message at debug level.

func (*ZapLogger) Debugf

func (s *ZapLogger) Debugf(format string, a ...interface{})

Debugf logs a message at debug level.

func (*ZapLogger) Debugw

func (s *ZapLogger) Debugw(msg string, keyvals ...interface{})

Debugw logs a message at debug level.

func (*ZapLogger) Error

func (s *ZapLogger) Error(a ...interface{})

Error logs a message at error level.

func (*ZapLogger) Errorf

func (s *ZapLogger) Errorf(format string, a ...interface{})

Errorf logs a message at error level.

func (*ZapLogger) Errorw

func (s *ZapLogger) Errorw(msg string, keyvals ...interface{})

Errorw logs a message at error level.

func (*ZapLogger) Fatal

func (s *ZapLogger) Fatal(a ...interface{})

Fatal logs a message at fatal level.

func (*ZapLogger) Fatalf

func (s *ZapLogger) Fatalf(format string, a ...interface{})

Fatalf logs a message at fatal level.

func (*ZapLogger) Fatalw

func (s *ZapLogger) Fatalw(msg string, keyvals ...interface{})

Fatalw logs a message at fatal level.

func (*ZapLogger) Info

func (s *ZapLogger) Info(a ...interface{})

Info logs a message at info level.

func (*ZapLogger) Infof

func (s *ZapLogger) Infof(format string, a ...interface{})

Infof logs a message at info level.

func (*ZapLogger) Infow

func (s *ZapLogger) Infow(msg string, keyvals ...interface{})

Infow logs a message at info level.

func (*ZapLogger) Log

func (s *ZapLogger) Log(level log.Level, keyvals ...interface{}) error

Log print the kv pairs log.

func (*ZapLogger) LogRoundTrip

func (s *ZapLogger) LogRoundTrip(
	req *http.Request,
	res *http.Response,
	err error,
	start time.Time,
	dur time.Duration,
) error

LogRoundTrip prints the information about request and response.

func (*ZapLogger) Printf

func (s *ZapLogger) Printf(format string, args ...interface{})

func (*ZapLogger) Println

func (s *ZapLogger) Println(a ...interface{})

func (*ZapLogger) RequestBodyEnabled

func (s *ZapLogger) RequestBodyEnabled() bool

RequestBodyEnabled makes the client pass request body to logger

func (*ZapLogger) ResponseBodyEnabled

func (s *ZapLogger) ResponseBodyEnabled() bool

RequestBodyEnabled makes the client pass response body to logger

func (*ZapLogger) Warn

func (s *ZapLogger) Warn(a ...interface{})

Warn logs a message at warn level.

func (*ZapLogger) Warnf

func (s *ZapLogger) Warnf(format string, a ...interface{})

Warnf logs a message at warnf level.

func (*ZapLogger) Warnw

func (s *ZapLogger) Warnw(msg string, keyvals ...interface{})

Warnw logs a message at warnf level.

type ZapLoggerEx

type ZapLoggerEx struct {
	ZapLogger
}

func NewZapLoggerEx

func NewZapLoggerEx(core zapcore.Core) *ZapLoggerEx

func (*ZapLoggerEx) Error

func (s *ZapLoggerEx) Error(err error, msg string, keysAndValues ...interface{})

Error logs an error condition.

func (*ZapLoggerEx) Info

func (s *ZapLoggerEx) Info(msg string, keysAndValues ...interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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