log

package module
v1.0.28 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 24 Imported by: 46

README

log

log is a rotated log, when log file reaches maxSize(default: 100MB), rotated files will be kept for maxDays(default: 7 days) or maxBackups(default: 5) whichever comes first.It wrapped zaplog and lumberjack.

NOTE: use release v1.0.2 and above, do NOT use releases below v1.0.2, because the behavior of old and new releases are different, and there is no way to delete old releases, because sum.golang.org will cache the checksum of old releases permanently and can not be cleaned.

how to use

import github.com/romberli/log

func main() {
    fileName := "/tmp/run.log"
    level := "info"
    format := "text"
    maxSize := 100 // MB
    maxDays := 7
    maxBackups := 5
    
    _, _, err = log.InitFileLogger(fileName, level, format, maxSize, maxDays, maxBackups)
    if err != nil {
        fmt.Printf("init logger failed.\n%s", err.Error())
    }
    
    log.Info("this is info message.")
    
    message := "some message"
    log.Warnf("this is warning message with variable message: %s", message")
}

or just specify log file name and use default value for other arguments

import github.com/romberli/log

func main() {
    fileName := "/tmp/run.log"

    _, _, err = log.InitFileLoggerWithDefault(fileName)
    if err != nil {
        fmt.Printf("init logger failed.\n%s", err.Error())
    }
    
    log.Info("this is info message.")
    
    message := "some message"
    log.Warnf("this is warning message with variable message: %s", message")
}

or specify nothing and log to stdout

import github.com/romberli/log

func main() {
    log.Info("this is info message.")
}

and you'll see the message in the console

customize

if you don't want double-quotes in message content, you can disable it.

log.SetDisableDoubleQuotes(true)

if you don't want to escape some special characters(\n,\r,\t) in the message content, you can disable it.

log.SetDisableEscape(true)

if you want to add another output to current logger, for example: add stdout to current file logger

log.AddWriteSyncer(log.NewWriteSyncer(os.stdout))

alternatively

log.AddWriteSyncer(log.NewStdoutWriteSyncer())

this impacts globally, so if you want to add new output temporally, you can clone a temporal logger and add new output to the new logger.

log.Clone().AddWriteSyncer(log.NewStdoutWriteSyncer()).Info("this is cloned logger message")

Documentation

Index

Constants

View Source
const (
	// default log file name
	DefaultLogFileName = "run.log"
	// default maximum log file size
	DefaultLogMaxSize = 100 // MB
	// default maximum log file backup days
	DefaultLogMaxDays = 7
	// default maximum log file backup number
	DefaultLogMaxBackups = 5
	// default log format in string
	DefaultLogFormat = "text"
	// default log level in string
	DefaultLogLevel            = "info"
	DefaultDisableTimestamp    = false
	DefaultDisableDoubleQuotes = false
	DefaultDisableEscape       = false
)
View Source
const (
	DebugLevel  = zap.DebugLevel
	InfoLevel   = zap.InfoLevel
	WarnLevel   = zap.WarnLevel
	ErrorLevel  = zap.ErrorLevel
	DPanicLevel = zap.DPanicLevel
	PanicLevel  = zap.PanicLevel
	FatalLevel  = zap.FatalLevel
)
View Source
const (
	DefaultCallerSkip = 1
)
View Source
const DefaultOutput = "stdout"

Variables

View Source
var (
	ErrEmptyLogFileName    = "Log file name could NOT be an empty string."
	ErrNotValidLogFileName = "Log file name must be either unix or windows path format, %s is not valid."
)
View Source
var (
	MyLogger *Logger
	MyProps  *ZapProperties
)
View Source
var (

	// Get retrieves a buffer from the pool, creating one if necessary.
	Get = _pool.Get
)

Functions

func AddWriteSyncer added in v1.0.12

func AddWriteSyncer(ws zapcore.WriteSyncer)

AddWriteSyncer add write syncer to multi write syncer, which allows to add a new way to write log message

func Debug

func Debug(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 Debugf

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

Debugf uses fmt.Sprintf to log a templated message.

func DefaultRotateOption added in v1.0.23

func DefaultRotateOption(name string, local bool) string

func DefaultTimeEncoder

func DefaultTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)

DefaultTimeEncoder serializes time.Time to a human-readable formatted string

func Error

func Error(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 Errorf

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

Errorf uses fmt.Sprintf to log a templated message.

func Fatal

func Fatal(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 Fatalf

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

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

func Info

func Info(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 Infof

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

Infof uses fmt.Sprintf to log a templated message.

func InitFileLogger added in v1.0.19

func InitFileLogger(fileName, level, format string, maxSize, maxDays, maxBackups int, options ...Option) (*Logger, *ZapProperties, error)

InitFileLogger initiates a file logger with given options

func InitFileLoggerWithDefault added in v1.0.20

func InitFileLoggerWithDefault(fileName string) (*Logger, *ZapProperties, error)

InitFileLoggerWithDefaultConfig initiates logger with default options

func InitLoggerWithConfig added in v1.0.2

func InitLoggerWithConfig(cfg *Config) (*Logger, *ZapProperties, error)

InitLoggerWithConfig initializes a zap logger with config.

func InitStdoutLogger added in v1.0.19

func InitStdoutLogger(level, format string) (*Logger, *ZapProperties, error)

InitStdoutLogger initiates a stdout logger with given level and format

func InitStdoutLoggerWithDefault added in v1.0.20

func InitStdoutLoggerWithDefault() (*Logger, *ZapProperties, error)

InitStdoutLogger initiates a stdout logger with given level and format

func NewLogger added in v1.0.12

func NewLogger() (*Logger, *ZapProperties, error)

NewLogger returns a logger which will write log message to stdout with default log level and format

func NewMultiWriteSyncer added in v1.0.12

func NewMultiWriteSyncer(ws ...zapcore.WriteSyncer) zapcore.WriteSyncer

NewMultiWriteSyncer creates a WriteSyncer that duplicates its writes and sync calls, much like io.MultiWriter.

func NewStdoutLogger added in v1.0.19

func NewStdoutLogger(level, format string) (*Logger, *ZapProperties, error)

NewStdoutLogger returns a logger which will write log message to stdout

func NewStdoutWriteSyncer added in v1.0.12

func NewStdoutWriteSyncer() zapcore.WriteSyncer

NewStdoutWriteSyncer returns a zapcore.WriteSyncer using os.Stdout

func NewTextCore

func NewTextCore(enc *textEncoder, ws zapcore.WriteSyncer, enab zapcore.LevelEnabler) zapcore.Core

NewTextCore creates a Core that writes logs to a WriteSyncer.

func NewTextEncoder

func NewTextEncoder(cfg *Config) zapcore.Encoder

NewTextEncoder creates a fast, low-allocation Text encoder. The encoder appropriately escapes all field keys and values.

func NewWriteSyncer added in v1.0.12

func NewWriteSyncer(w io.Writer) zapcore.WriteSyncer

NewWriteSyncer returns a new zapcore.WriteSyncer

func Panic

func Panic(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 Panicf

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

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

func ReplaceGlobals

func ReplaceGlobals(logger *Logger, props *ZapProperties)

ReplaceGlobals replaces global logger with given logger and properties

func Rotate added in v1.0.24

func Rotate() error

Rotate rotates the log file of global logger

func S

func S() *zap.SugaredLogger

S returns the global SugaredLogger, which can be reconfigured with ReplaceGlobals. It's safe for concurrent use.

func SetDisableDoubleQuotes added in v1.0.10

func SetDisableDoubleQuotes(disableDoubleQuotes bool)

SetDisableDoubleQuotes disables wrapping log content with double quotes of global logger

func SetDisableEscape added in v1.0.11

func SetDisableEscape(disableEscape bool)

SetDisableEscape disables wrapping log content with double quotes of global logger

func SetLevel

func SetLevel(l Level)

SetLevel alters the logging level.

func ShortCallerEncoder

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

ShortCallerEncoder serializes a caller in file:line format.

func StringToLogFormatter added in v1.0.2

func StringToLogFormatter(format string, disableTimestamp bool) logrus.Formatter

func Warn

func Warn(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 Warnf

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

Warnf uses fmt.Sprintf to log a templated message.

func With

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

With creates a child logger and adds structured context to it. Fields added to the child don't affect the parent, and vice versa.

Types

type Config

type Config struct {
	// Log level.
	Level string `yaml:"level" json:"level"`
	// Log format. one of json, text, or console.
	Format string `yaml:"format" json:"format"`
	// Disable automatic timestamps in output.
	DisableTimestamp bool `yaml:"disable-timestamp" json:"disable-timestamp"`
	// File log config.
	File FileLogConfig `yaml:"file" json:"file"`
	// Development puts the logger in development mode, which changes the
	// behavior of DPanicLevel and takes stacktraces more liberally.
	Development bool `yaml:"development" json:"development"`
	// DisableDoubleQuote disables adding double-quotes to log entry
	DisableDoubleQuotes bool
	// DisableEscape disables escaping special characters like \n,\r...
	DisableEscape bool
	// DisableCaller stops annotating logs with the calling function's file
	// name and line number. By default, all logs are annotated.
	DisableCaller bool `yaml:"disable-caller" json:"disable-caller"`
	// DisableStacktrace completely disables automatic stacktrace capturing. By
	// default, stacktraces are captured for WarnLevel and above logs in
	// development and ErrorLevel and above in production.
	DisableStacktrace bool `yaml:"disable-stacktrace" json:"disable-stacktrace"`
	// DisableErrorVerbose stops annotating logs with the full verbose error
	// message.
	DisableErrorVerbose bool `yaml:"disable-error-verbose" json:"disable-error-verbose"`
	// SamplingConfig sets a sampling strategy for the logger. Sampling caps the
	// global CPU and I/O load that logging puts on your process while attempting
	// to preserve a representative subset of your logs.
	//
	// Values configured here are per-second. See zapcore.NewSampler for details.
	Sampling *zap.SamplingConfig `yaml:"sampling" json:"sampling"`
}

Config serializes log related config in yaml/json.

func NewConfig

func NewConfig(level, format string, fileCfg FileLogConfig) *Config

NewConfig creates a Config.

func NewConfigWithFileLog added in v1.0.2

func NewConfigWithFileLog(fileName, level, format string, maxSize, maxDays, maxBackups int, options ...Option) (*Config, error)

NewConfigWithFileLog returns a *Config with file options

func NewConfigWithStdout added in v1.0.19

func NewConfigWithStdout(level, format string) *Config

NewConfigWithStdout returns a *Config with given level and format

func (*Config) SetDisableDoubleQuotes added in v1.0.10

func (cfg *Config) SetDisableDoubleQuotes(disableDoubleQuotes bool)

SetDisableDoubleQuotes disables wrapping log content with double quotes

func (*Config) SetDisableEscape added in v1.0.11

func (cfg *Config) SetDisableEscape(disableEscape bool)

SetDisableEscape disables escaping special characters of log content like \n,\r...

type FileLogConfig

type FileLogConfig struct {
	FileName   string
	MaxSize    int
	MaxDays    int
	MaxBackups int
	Options    []Option
}

FileLogConfig serializes file log related config in yaml/json.

func NewEmptyFileLogConfig added in v1.0.19

func NewEmptyFileLogConfig() *FileLogConfig

NewEmptyFileLogConfig returns an empty *FileLogConfig

func NewFileLogConfig

func NewFileLogConfig(fileName string, maxSize, maxDays, maxBackups int, options ...Option) (fileLogConfig *FileLogConfig, err error)

NewFileLogConfig creates a FileLogConfig.

func NewFileLogConfigWithDefaultFileName added in v1.0.3

func NewFileLogConfigWithDefaultFileName(fileName string, maxSize, maxDays, maxBackups int) (fileLogConfig *FileLogConfig, err error)

NewFileLogConfigWithDefaultFileName creates a FileLogConfig, if fileName is empty, it will use default file name.

type Level added in v1.0.1

type Level = zapcore.Level

func ConvertToLevel added in v1.0.28

func ConvertToLevel(level string) Level

func GetLevel

func GetLevel() Level

GetLevel gets the logging level.

type Logger added in v1.0.2

type Logger struct {
	SugaredLogger *zap.SugaredLogger
	// contains filtered or unexported fields
}

Logger wraps zap logger and sugared logger

func Clone added in v1.0.13

func Clone() *Logger

Clone clones global logger

func CloneAndAddWriteSyncer added in v1.0.13

func CloneAndAddWriteSyncer(ws zapcore.WriteSyncer) *Logger

CloneAndAddWriteSyncer clones global logger and add specified write syncer to it

func CloneLogger added in v1.0.13

func CloneLogger(logger *Logger) *Logger

CloneLogger returns a fresh new logger with same options

func CloneStdoutLogger added in v1.0.16

func CloneStdoutLogger() *Logger

CloneStdoutLogger clones global logger and add stdout write syncer to it

func L

func L() *Logger

L returns the global Logger, which can be reconfigured with ReplaceGlobals. It's safe for concurrent use.

func NewMyLogger added in v1.0.2

func NewMyLogger(logger *zap.Logger) *Logger

NewMyLogger returns *Logger

func (*Logger) AddWriteSyncer added in v1.0.12

func (logger *Logger) AddWriteSyncer(ws zapcore.WriteSyncer)

AddWriteSyncer adds write syncer to multi write syncer, which allows to add a new way to write log message

func (*Logger) Clone added in v1.0.13

func (logger *Logger) Clone() *Logger

Clone clones logger and returns the new one

func (*Logger) CloneAndAddWriteSyncer added in v1.0.13

func (logger *Logger) CloneAndAddWriteSyncer(ws zapcore.WriteSyncer) *Logger

CloneAndAddWriteSyncer adds write syncer to multi write syncer, which allows to add a new way to write log message

func (*Logger) Debug added in v1.0.9

func (logger *Logger) Debug(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) Debugf added in v1.0.2

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

Debugf uses fmt.Sprintf to log a templated message.

func (*Logger) Error added in v1.0.9

func (logger *Logger) Error(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) Errorf added in v1.0.2

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

Errorf uses fmt.Sprintf to log a templated message.

func (*Logger) Fatal added in v1.0.9

func (logger *Logger) Fatal(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) Fatalf added in v1.0.2

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

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

func (*Logger) Info added in v1.0.9

func (logger *Logger) Info(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) Infof added in v1.0.2

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

Infof uses fmt.Sprintf to log a templated message.

func (*Logger) Panic added in v1.0.9

func (logger *Logger) Panic(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) Panicf added in v1.0.2

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

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

func (*Logger) Rotate added in v1.0.23

func (logger *Logger) Rotate() error

Rotate rotates log file

func (*Logger) SetDisableDoubleQuotes added in v1.0.10

func (logger *Logger) SetDisableDoubleQuotes(disableDoubleQuotes bool)

SetDisableDoubleQuotes disables wrapping log content with double quotes

func (*Logger) SetDisableEscape added in v1.0.11

func (logger *Logger) SetDisableEscape(disableEscape bool)

SetDisableEscape disables escaping special characters of log content like \n,\r...

func (*Logger) Sugar added in v1.0.9

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

Sugar returns a new sugared logger

func (*Logger) Warn added in v1.0.9

func (logger *Logger) Warn(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) Warnf added in v1.0.2

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

Warnf uses fmt.Sprintf to log a templated message.

func (*Logger) WithOptions added in v1.0.9

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

WithOptions returns a new *Logger with specified options

type MultiWriteSyncer added in v1.0.12

type MultiWriteSyncer []zapcore.WriteSyncer

func (MultiWriteSyncer) List added in v1.0.12

func (ws MultiWriteSyncer) List() []zapcore.WriteSyncer

List lists write syncer of MultiWriteSyncer.

func (MultiWriteSyncer) Sync added in v1.0.12

func (ws MultiWriteSyncer) Sync() error

func (MultiWriteSyncer) Write added in v1.0.12

func (ws MultiWriteSyncer) Write(p []byte) (int, error)

See https://golang.org/src/io/multi.go When not all underlying syncers write the same number of bytes, the smallest number is returned even though Write() is called on all of them.

type Option added in v1.0.23

type Option func(name string, local bool) string

type WriteSyncer added in v1.0.23

type WriteSyncer struct {
	io.Writer
	// contains filtered or unexported fields
}

func (WriteSyncer) GetWriteSyncer added in v1.0.23

func (ws WriteSyncer) GetWriteSyncer() zapcore.WriteSyncer

GetWriteSyncer returns the underlying WriteSyncer of the WriteSyncer

func (WriteSyncer) GetWriter added in v1.0.23

func (ws WriteSyncer) GetWriter() io.Writer

GetWriter returns the underlying writer of the WriteSyncer

func (WriteSyncer) Sync added in v1.0.23

func (ws WriteSyncer) Sync() error

Sync implements zapcore.WriteSyncer

type Writer added in v1.0.23

type Writer struct {
	// Filename is the file to write logs to.  Backup log files will be retained
	// in the same directory.  It uses <processname>-lumberjack.log in
	// os.TempDir() if empty.
	Filename string `json:"filename" yaml:"filename"`

	// MaxSize is the maximum size in megabytes of the log file before it gets
	// rotated. It defaults to 100 megabytes.
	MaxSize int `json:"maxsize" yaml:"maxsize"`

	// MaxAge is the maximum number of days to retain old log files based on the
	// timestamp encoded in their filename.  Note that a day is defined as 24
	// hours and may not exactly correspond to calendar days due to daylight
	// savings, leap seconds, etc. The default is not to remove old log files
	// based on age.
	MaxAge int `json:"maxage" yaml:"maxage"`

	// MaxBackups is the maximum number of old log files to retain.  The default
	// is to retain all old log files (though MaxAge may still cause them to get
	// deleted.)
	MaxBackups int `json:"maxbackups" yaml:"maxbackups"`

	// LocalTime determines if the time used for formatting the timestamps in
	// backup files is the computer's local time.  The default is to use UTC
	// time.
	LocalTime bool `json:"localtime" yaml:"localtime"`

	// Compress determines if the rotated log files should be compressed
	// using gzip. The default is not to perform compression.
	Compress bool `json:"compress" yaml:"compress"`

	// Options is an optional function slices that returns the backup file name,
	// note that, only the first option will be applied.
	Options []Option
	// contains filtered or unexported fields
}

Writer is an io.WriteCloser that writes to the specified filename.

Writer opens or creates the logfile on first Write. If the file exists and is less than MaxSize megabytes, lumberjack will open and append to that file. If the file exists and its size is >= MaxSize megabytes, the file is renamed by putting the current time in a timestamp in the name immediately before the file's extension (or the end of the filename if there's no extension). A new log file is then created using original filename.

Whenever a write would cause the current log file exceed MaxSize megabytes, the current file is closed, renamed, and a new log file created with the original name. Thus, the filename you give Writer is always the "current" log file.

Backups use the log file name given to Writer, in the form `name-timestamp.ext` where name is the filename without the extension, timestamp is the time at which the log was rotated formatted with the time.Time format of `2006-01-02T15-04-05.000` and the extension is the original extension. For example, if your Writer.Filename is `/var/log/foo/server.log`, a backup created at 6:30pm on Nov 11 2016 would use the filename `/var/log/foo/server-2016-11-04T18-30-00.000.log`

Cleaning Up Old Log Files

Whenever a new logfile gets created, old log files may be deleted. The most recent files according to the encoded timestamp will be retained, up to a number equal to MaxBackups (or all of them if MaxBackups is 0). Any files with an encoded timestamp older than MaxAge days are deleted, regardless of MaxBackups. Note that the time encoded in the timestamp is the rotation time, which may differ from the last time that file was written to.

If MaxBackups and MaxAge are both 0, no old log files will be deleted.

func InitLumberjackLoggerWithFileLogConfig added in v1.0.20

func InitLumberjackLoggerWithFileLogConfig(cfg *FileLogConfig) (*Writer, error)

InitLumberjackLoggerWithFileLogConfig initializes file based logging options.

func (*Writer) Close added in v1.0.23

func (w *Writer) Close() error

Close implements io.Closer, and closes the current logfile.

func (*Writer) Rotate added in v1.0.23

func (w *Writer) Rotate() error

Rotate causes Writer to close the existing log file and immediately create a new one. This is a helper function for applications that want to initiate rotations outside the normal rotation rules, such as in response to SIGHUP. After rotating, this initiates compression and removal of old log files according to the configuration.

func (*Writer) Write added in v1.0.23

func (w *Writer) Write(p []byte) (n int, err error)

Write implements io.Writer. If a write would cause the log file to be larger than MaxSize, the file is closed, renamed to include a timestamp of the current time, and a new log file is created using the original log file name. If the length of the write is greater than MaxSize, an error is returned.

type ZapProperties

type ZapProperties struct {
	Core   zapcore.Core
	Syncer zapcore.WriteSyncer
	Level  zap.AtomicLevel
}

ZapProperties records some information about zap

func InitZapLoggerWithWriteSyncer added in v1.0.20

func InitZapLoggerWithWriteSyncer(cfg *Config, output zapcore.WriteSyncer, opts ...zap.Option) (*zap.Logger, *ZapProperties, error)

InitZapLoggerWithWriteSyncer initializes a zap logger with specified write syncer.

func P added in v1.0.25

func P() *ZapProperties

P returns the global properties, which can be reconfigured with ReplaceGlobals. It's safe for concurrent use.

func (*ZapProperties) Clone added in v1.0.20

func (props *ZapProperties) Clone() *ZapProperties

Clone returns a fresh new *ZapProperties with same options, note that it will use the same syncer

func (*ZapProperties) SetCore added in v1.0.20

func (props *ZapProperties) SetCore(core zapcore.Core)

SetCore sets the core

func (*ZapProperties) WithCore added in v1.0.20

func (props *ZapProperties) WithCore(core zapcore.Core) *ZapProperties

WithCore returns a fresh new *ZapProperties with given core

Jump to

Keyboard shortcuts

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