Documentation ¶
Index ¶
- func DPanic(msg string, fields ...internal.Field)
- func DPanicF(format string, a ...interface{})
- func Debug(msg string, fields ...internal.Field)
- func DebugF(format string, a ...interface{})
- func Error(msg string, fields ...internal.Field)
- func ErrorF(format string, a ...interface{})
- func Fatal(msg string, fields ...internal.Field)
- func FatalF(format string, a ...interface{})
- func Info(msg string, fields ...internal.Field)
- func InfoF(format string, a ...interface{})
- func Named(s string, opts ...zap.Option) internal.XLog
- func Panic(msg string, fields ...internal.Field)
- func PanicF(format string, a ...interface{})
- func SetLog(zl XLog) error
- func Sync(ll ...XLog) (err error)
- func Warn(msg string, fields ...internal.Field)
- func WarnF(format string, a ...interface{})
- func With(fields ...zap.Field) internal.XLog
- type Field
- func Any(key string, value interface{}) Field
- func Binary(key string, val []byte) Field
- func Bool(key string, val bool) Field
- func ByteString(key string, val []byte) Field
- func Complex128(key string, val complex128) Field
- func Complex64(key string, val complex64) Field
- func Duration(key string, val time.Duration) Field
- func Float32(key string, val float32) Field
- func Float64(key string, val float64) Field
- func Fmt(format string, a ...interface{}) Field
- func Int(key string, val int) Field
- func Int16(key string, val int16) Field
- func Int32(key string, val int32) Field
- func Int64(key string, val int64) Field
- func Int8(key string, val int8) Field
- func Object(key string, val zapcore.ObjectMarshaler) Field
- func Reflect(key string, val interface{}) Field
- func Skip() Field
- func Stack(key string) Field
- func String(key string, val string) Field
- func Stringer(key string, val fmt.Stringer) Field
- func Time(key string, val time.Time) Field
- func Uint(key string, val uint) Field
- func Uint16(key string, val uint16) Field
- func Uint32(key string, val uint32) Field
- func Uint64(key string, val uint64) Field
- func Uint8(key string, val uint8) Field
- func Uintptr(key string, val uintptr) Field
- type Option
- func AddCaller() Option
- func AddCallerSkip(skip int) Option
- func AddStacktrace(lvl zapcore.LevelEnabler) Option
- func Development() Option
- func ErrorOutput(w zapcore.WriteSyncer) Option
- func Fields(fs ...Field) Option
- func Hooks(hooks ...func(zapcore.Entry) error) Option
- func IncreaseLevel(lvl zapcore.LevelEnabler) Option
- func WithCaller(enabled bool) Option
- type XLog
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Field ¶
func Any ¶
Any takes a key and an arbitrary value and chooses the best way to represent them as a field, falling back to a reflection-based approach only if necessary.
Since byte/uint8 and rune/int32 are aliases, Any can't differentiate between them. To minimize surprises, []byte values are treated as binary blobs, byte values are treated as uint8, and runes are always treated as integers.
func Binary ¶
Binary constructs a field that carries an opaque binary blob.
Binary data is serialized in an encoding-appropriate format. For example, zap's JSON encoder base64-encodes binary blobs. To log UTF-8 encoded text, use ByteString.
func ByteString ¶
ByteString constructs a field that carries UTF-8 encoded text as a []byte. To log opaque binary blobs (which aren't necessarily valid UTF-8), use Binary.
func Complex128 ¶
func Complex128(key string, val complex128) Field
Complex128 constructs a field that carries a complex number. Unlike most numeric fields, this costs an allocation (to convert the complex128 to interface{}).
func Complex64 ¶
Complex64 constructs a field that carries a complex number. Unlike most numeric fields, this costs an allocation (to convert the complex64 to interface{}).
func Duration ¶
Duration constructs a field with the given key and value. The encoder controls how the duration is serialized.
func Float32 ¶
Float32 constructs a field that carries a float32. The way the floating-point value is represented is encoder-dependent, so marshaling is necessarily lazy.
func Float64 ¶
Float64 constructs a field that carries a float64. The way the floating-point value is represented is encoder-dependent, so marshaling is necessarily lazy.
func Object ¶
func Object(key string, val zapcore.ObjectMarshaler) Field
Object constructs a field with the given key and ObjectMarshaler. It provides a flexible, but still type-safe and efficient, way to add map- or struct-like user-defined types to the logging context. The struct's MarshalLogObject method is called lazily.
func Reflect ¶
Reflect constructs a field with the given key and an arbitrary object. It uses an encoding-appropriate, reflection-based function to lazily serialize nearly any object into the logging context, but it's relatively slow and allocation-heavy. Outside tests, Any is always a better choice.
If encoding fails (e.g., trying to serialize a map[int]string to JSON), Reflect includes the error message in the final log output.
func Skip ¶
func Skip() Field
Skip constructs a no-op field, which is often useful when handling invalid inputs in other Field constructors.
func Stack ¶
Stack constructs a field that stores a stacktrace of the current goroutine under provided key. Keep in mind that taking a stacktrace is eager and expensive (relatively speaking); this function both makes an allocation and takes about two microseconds.
func Stringer ¶
Stringer constructs a field with the given key and the output of the value's String method. The Stringer's String method is called lazily.
func Time ¶
Time constructs a Field with the given key and value. The encoder controls how the time is serialized.
type Option ¶ added in v0.0.6
func AddCallerSkip ¶ added in v0.0.6
func AddStacktrace ¶ added in v0.0.6
func AddStacktrace(lvl zapcore.LevelEnabler) Option
func Development ¶ added in v0.0.6
func Development() Option
func ErrorOutput ¶ added in v0.0.6
func ErrorOutput(w zapcore.WriteSyncer) Option
func IncreaseLevel ¶ added in v0.0.6
func IncreaseLevel(lvl zapcore.LevelEnabler) Option
func WithCaller ¶ added in v0.0.6
Directories ¶
Path | Synopsis |
---|---|
writer/rotate/file-rotatelogs
package rotatelogs is a port of File-RotateLogs from Perl (https://metacpan.org/release/File-RotateLogs), and it allows you to automatically rotate output files when you write to them according to the filename pattern that you can specify.
|
package rotatelogs is a port of File-RotateLogs from Perl (https://metacpan.org/release/File-RotateLogs), and it allows you to automatically rotate output files when you write to them according to the filename pattern that you can specify. |