Documentation
¶
Index ¶
- Constants
- type ColorSchemaConfig
- type ColorScheme
- type Config
- type Encoder
- func (e *Encoder) AddArray(key string, marshaler zapcore.ArrayMarshaler) error
- func (e *Encoder) AddBinary(key string, val []byte)
- func (e *Encoder) AddBool(key string, val bool)
- func (e *Encoder) AddByteString(key string, val []byte)
- func (e *Encoder) AddComplex64(key string, val complex64)
- func (e *Encoder) AddComplex128(key string, val complex128)
- func (e *Encoder) AddDuration(key string, val time.Duration)
- func (e *Encoder) AddFloat32(key string, val float32)
- func (e *Encoder) AddFloat64(key string, val float64)
- func (e *Encoder) AddInt(key string, val int)
- func (e *Encoder) AddInt8(key string, val int8)
- func (e *Encoder) AddInt16(key string, val int16)
- func (e *Encoder) AddInt32(key string, val int32)
- func (e *Encoder) AddInt64(key string, val int64)
- func (e *Encoder) AddObject(key string, obj zapcore.ObjectMarshaler) error
- func (e *Encoder) AddReflected(key string, val interface{}) error
- func (e *Encoder) AddString(key string, val string)
- func (e *Encoder) AddTime(key string, val time.Time)
- func (e *Encoder) AddUint(key string, val uint)
- func (e *Encoder) AddUint8(key string, val uint8)
- func (e *Encoder) AddUint16(key string, val uint16)
- func (e *Encoder) AddUint32(key string, val uint32)
- func (e *Encoder) AddUint64(key string, val uint64)
- func (e *Encoder) AddUintptr(key string, val uintptr)
- func (e *Encoder) AppendArray(arr zapcore.ArrayMarshaler) error
- func (e *Encoder) AppendBool(val bool)
- func (e *Encoder) AppendByteString(bstr []byte)
- func (e *Encoder) AppendComplex64(val complex64)
- func (e *Encoder) AppendComplex128(val complex128)
- func (e *Encoder) AppendDuration(val time.Duration)
- func (e *Encoder) AppendFloat32(val float32)
- func (e *Encoder) AppendFloat64(val float64)
- func (e *Encoder) AppendInt(val int)
- func (e *Encoder) AppendInt8(val int8)
- func (e *Encoder) AppendInt16(val int16)
- func (e *Encoder) AppendInt32(val int32)
- func (e *Encoder) AppendInt64(val int64)
- func (e *Encoder) AppendObject(obj zapcore.ObjectMarshaler) error
- func (e *Encoder) AppendReflected(val interface{}) error
- func (e *Encoder) AppendString(str string)
- func (e *Encoder) AppendTime(val time.Time)
- func (e *Encoder) AppendUint(val uint)
- func (e *Encoder) AppendUint8(val uint8)
- func (e *Encoder) AppendUint16(val uint16)
- func (e *Encoder) AppendUint32(val uint32)
- func (e *Encoder) AppendUint64(val uint64)
- func (e *Encoder) AppendUintptr(val uintptr)
- func (e *Encoder) Clone() zapcore.Encoder
- func (e *Encoder) EncodeEntry(ent zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error)
- func (e *Encoder) OpenNamespace(_ string)
- type EncoderConfig
Constants ¶
View Source
const ( Black uint16 Red Green Yellow Blue Magenta Cyan White )
View Source
const ( BackgroundBlack uint16 BackgroundRed BackgroundGreen BackgroundYellow BackgroundBlue BackgroundMagenta BackgroundCyan BackgroundWhite )
View Source
const ( // Bold flag for ColorScheme. Bold uint16 = 1<<bitsBold | NoColor )
View Source
const ( // No color NoColor uint16 = 1 << 15 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColorSchemaConfig ¶
type ColorSchemaConfig struct {
Timestamp string `logos-config:"timestamp"`
Naming string `logos-config:"naming"`
InfoLevel string `logos-config:"info_level"`
WarnLevel string `logos-config:"warn_level"`
ErrorLevel string `logos-config:"error_level"`
FatalLevel string `logos-config:"fatal_level"`
PanicLevel string `logos-config:"panic_level"`
DPanicLevel string `logos-config:"dpanic_level"`
DebugLevel string `logos-config:"debug_level"`
}
Schema is the color schema for the default log parts/levels
func (ColorSchemaConfig) Parse ¶
func (c ColorSchemaConfig) Parse() ColorScheme
type ColorScheme ¶
type ColorScheme struct {
Bool uint16
Integer uint16
Float uint16
String uint16
StringQuotation uint16
EscapedChar uint16
FieldName uint16
PointerAddress uint16
Nil uint16
Time uint16
StructName uint16
ObjectLength uint16
LogNaming uint16
Timestamp uint16
InfoLevel uint16
WarnLevel uint16
ErrorLevel uint16
FatalLevel uint16
PanicLevel uint16
DPanicLevel uint16
DebugLevel uint16
}
To use with SetColorScheme.
type Config ¶
type Config struct {
// color schema for messages
ColorSchema *ColorSchemaConfig `logos-config:"color_scheme"`
// no colors
DisableColors bool `logos-config:"disable_colors"`
// no check for TTY terminal
ForceColors bool `logos-config:"force_colors"`
// false -> name passed, true -> github.com/khorevaa/logos
DisableNaming bool `logos-config:"disable_naming"`
// no timestamp
DisableTimestamp bool `logos-config:"disable_timestamp"`
// console separator default space
ConsoleSeparator string `logos-config:"console_separator"`
// false -> time passed, true -> timestamp
UseTimePassedAsTimestamp bool `logos-config:"pass_timestamp"`
// false -> info, true -> INFO
UseUppercaseLevel bool `logos-config:"uppercase_level"`
TimestampFormat string `logos-config:"timestamp_format"`
LineEnding string `logos-config:"line_ending"`
}
Config is used to pass encoding parameters to New.
type Encoder ¶
type Encoder struct {
EncoderConfig
// contains filtered or unexported fields
}
Encoder is a bol.com tailored zap encoder for writing human readable logs to the console
func NewEncoder ¶
func NewEncoder(cfg EncoderConfig) *Encoder
NewEncoder initializes a a bol.com tailored Encoder
func (*Encoder) AddArray ¶
func (e *Encoder) AddArray(key string, marshaler zapcore.ArrayMarshaler) error
func (*Encoder) AddByteString ¶
func (*Encoder) AddComplex64 ¶
func (*Encoder) AddComplex128 ¶
func (e *Encoder) AddComplex128(key string, val complex128)
func (*Encoder) AddFloat32 ¶
func (*Encoder) AddFloat64 ¶
func (*Encoder) AddObject ¶
func (e *Encoder) AddObject(key string, obj zapcore.ObjectMarshaler) error
func (*Encoder) AddReflected ¶
func (*Encoder) AddUintptr ¶
func (*Encoder) AppendArray ¶
func (e *Encoder) AppendArray(arr zapcore.ArrayMarshaler) error
func (*Encoder) AppendBool ¶
func (*Encoder) AppendByteString ¶
func (*Encoder) AppendComplex64 ¶
func (*Encoder) AppendComplex128 ¶
func (e *Encoder) AppendComplex128(val complex128)
func (*Encoder) AppendDuration ¶
func (*Encoder) AppendFloat32 ¶
func (*Encoder) AppendFloat64 ¶
func (*Encoder) AppendInt8 ¶
func (*Encoder) AppendInt16 ¶
func (*Encoder) AppendInt32 ¶
func (*Encoder) AppendInt64 ¶
func (*Encoder) AppendObject ¶
func (e *Encoder) AppendObject(obj zapcore.ObjectMarshaler) error
func (*Encoder) AppendReflected ¶
func (*Encoder) AppendString ¶
func (*Encoder) AppendTime ¶
func (*Encoder) AppendUint ¶
func (*Encoder) AppendUint8 ¶
func (*Encoder) AppendUint16 ¶
func (*Encoder) AppendUint32 ¶
func (*Encoder) AppendUint64 ¶
func (*Encoder) AppendUintptr ¶
func (*Encoder) EncodeEntry ¶
EncodeEntry implements the EncodeEntry method of the zapcore Encoder interface
func (*Encoder) OpenNamespace ¶
type EncoderConfig ¶
type EncoderConfig struct {
// no colors
DisableColors bool
// no check for TTY terminal
ForceColors bool
// false -> time passed, true -> timestamp
UseTimePassedAsTimestamp bool
// false -> info, true -> INFO
UseUppercaseLevel bool
// false -> name passed, true -> github.com/khorevaa/logos
DisableNaming bool
// no timestamp
DisableTimestamp bool
// console separator default space
ConsoleSeparator string
// line end for log
LineEnding string
// time format string
TimestampFormat string
// color schema for messages
Schema ColorScheme
}
EncoderConfig is used to pass encoding parameters to New.
Click to show internal directories.
Click to hide internal directories.