zap

package
v0.5.17 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinSplitLogFileSize = 1024 * 1024
)

Variables

This section is empty.

Functions

func CapitalLevelEncoder

func CapitalLevelEncoder(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder)

func LogNameEncoder

func LogNameEncoder(loggerName string, enc zapcore.PrimitiveArrayEncoder)

func NewLogger

func NewLogger(opts ...slog.Option) (slog.BoxLogger, error)

NewLogger builds a new logger based on options

func ShortEncodeCaller added in v0.4.8

func ShortEncodeCaller(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder)

Types

type Options

type Options struct {
	*slog.Options
	// contains filtered or unexported fields
}

type SysLogConfig added in v0.5.17

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

type SysLogOption added in v0.5.17

type SysLogOption func(*SysLogConfig)

func WithAddress added in v0.5.17

func WithAddress(addr string) SysLogOption

WithAddress 设置log server 地址,如/dev/log 或者 localhost:514 等

func WithNetwork added in v0.5.17

func WithNetwork(network string) SysLogOption

WithNetwork 设置连接类型 udp/tcp/unixgram/unix 等

func WithPriority added in v0.5.17

func WithPriority(priority syslog.Priority) SysLogOption

WithPriority 设置日志优先级

type SysLogSyncer added in v0.5.17

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

SysLogSyncer is a zapcore.WriteSyncer implementation that writes to syslog.

func NewSysLog added in v0.5.17

func NewSysLog(opts ...SysLogOption) (*SysLogSyncer, error)

func (*SysLogSyncer) Close added in v0.5.17

func (c *SysLogSyncer) Close() error

func (*SysLogSyncer) Sync added in v0.5.17

func (c *SysLogSyncer) Sync() error

Sync implements zap core.WriteSyncer interface.

func (*SysLogSyncer) Write added in v0.5.17

func (c *SysLogSyncer) Write(message []byte) (int, error)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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