Documentation ¶
Index ¶
- func AppendNotice(ctx context.Context, keysAndValues ...interface{})
- func BaggageFlowField(ctx context.Context) (f zap.Field)
- func ExtFields(ctx context.Context) (fs []zap.Field)
- func GetGid() int64
- func IsSecrecyMsg(msg string) bool
- func L(ctx context.Context) *zap.Logger
- func New(conf Config) (*zap.Logger, error)
- func S(ctx context.Context) *zap.SugaredLogger
- func Set(conf Config) (func(), error)
- func SpanIDField(ctx context.Context) zap.Field
- func TraceIdField(ctx context.Context) (f zap.Field)
- type ByteMarshaler
- type Config
- type FileLogConfig
- type JsonMarshaler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendNotice ¶
func BaggageFlowField ¶
BaggageFlowField Todo: get baggage flow
func IsSecrecyMsg ¶
Types ¶
type ByteMarshaler ¶
func (*ByteMarshaler) MarshalJSON ¶
func (j *ByteMarshaler) MarshalJSON() ([]byte, error)
func (*ByteMarshaler) MarshalLogObject ¶
func (j *ByteMarshaler) MarshalLogObject(e zapcore.ObjectEncoder) error
type Config ¶
type Config struct { ServiceName string `yaml:"serviceName"` // 日志级别. Level string `yaml:"level"` // Log format. one of json or plain. Format string `yaml:"format"` // 是否输出到控制台. Stdout bool `yaml:"stdout"` // File log config. File FileLogConfig `yaml:"file"` }
Config serializes log related config in toml/json.
type FileLogConfig ¶
type FileLogConfig struct { // 日志文件路径. Filename string `yaml:"filename"` // Is log rotate enabled. LogRotate bool `yaml:"logRotate"` // Max size for a single file, in MB. MaxSize int `yaml:"maxSize"` // Max log keep days, default is never deleting. MaxDays int `yaml:"maxDays"` // Maximum number of old log files to retain. MaxBackups int `yaml:"maxBackups"` // MAX size of bufio.Writer BufSize int `yaml:"bufSize"` }
FileLogConfig serializes file log related config.
type JsonMarshaler ¶
type JsonMarshaler struct { Key string Data interface{} }
func (*JsonMarshaler) MarshalJSON ¶
func (j *JsonMarshaler) MarshalJSON() ([]byte, error)
func (*JsonMarshaler) MarshalLogObject ¶
func (j *JsonMarshaler) MarshalLogObject(e zapcore.ObjectEncoder) error
func (*JsonMarshaler) NeedKeepSecrecy ¶
func (j *JsonMarshaler) NeedKeepSecrecy() bool
Click to show internal directories.
Click to hide internal directories.