Documentation ¶
Index ¶
- Constants
- func ColoredHashedNameEncoder(s string, enc zapcore.PrimitiveArrayEncoder)
- func ColoredLevelEncoder(level zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
- func ColoredNameEncoder(s string, enc zapcore.PrimitiveArrayEncoder)
- func UTCTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
- type ChannelConfig
- type Config
- type Logger
- type WithLogger
- type ZapAdapter
- func (log *ZapAdapter) Debug(msg string, keyvals ...interface{})
- func (log *ZapAdapter) Error(msg string, keyvals ...interface{})
- func (log *ZapAdapter) Info(msg string, keyvals ...interface{})
- func (log *ZapAdapter) Warn(msg string, keyvals ...interface{})
- func (log *ZapAdapter) With(keyvals ...interface{}) Logger
- type ZapLogger
Constants ¶
View Source
const PluginName = "logs"
PluginName declares plugin name.
Variables ¶
This section is empty.
Functions ¶
func ColoredHashedNameEncoder ¶
func ColoredHashedNameEncoder(s string, enc zapcore.PrimitiveArrayEncoder)
ColoredHashedNameEncoder colorizes service names and assigns different colors to different names.
func ColoredLevelEncoder ¶
func ColoredLevelEncoder(level zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
ColoredLevelEncoder colorizes log levels.
func ColoredNameEncoder ¶
func ColoredNameEncoder(s string, enc zapcore.PrimitiveArrayEncoder)
ColoredNameEncoder colorizes service names.
func UTCTimeEncoder ¶
func UTCTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
UTCTimeEncoder encodes time into short UTC specific timestamp.
Types ¶
type ChannelConfig ¶
type ChannelConfig struct { // Dedicated channels per logger. By default logger allocated via named logger. Channels map[string]Config `mapstructure:"channels"` }
ChannelConfig configures loggers per channel.
type Config ¶
type Config struct { // Mode configures logger based on some default template (development, production, off). Mode string `mapstructure:"mode"` // Level is the minimum enabled logging level. Note that this is a dynamic // level, so calling ChannelConfig.Level.SetLevel will atomically change the log // level of all loggers descended from this config. Level string `mapstructure:"level"` // Encoding sets the logger's encoding. Valid values are "json" and // "console", as well as any third-party encodings registered via // RegisterEncoder. Encoding string `mapstructure:"encoding"` // Output is a list of URLs or file paths to write logging output to. // See Open for details. Output []string `mapstructure:"output"` // ErrorOutput is a list of URLs to write internal logger errors to. // The default is standard error. // // Note that this setting only affects internal errors; for sample code that // sends error-level logs to a different location from info- and debug-level // logs, see the package-level AdvancedConfiguration example. ErrorOutput []string `mapstructure:"errorOutput"` }
type Logger ¶
type Logger interface { Debug(msg string, keyvals ...interface{}) Info(msg string, keyvals ...interface{}) Warn(msg string, keyvals ...interface{}) Error(msg string, keyvals ...interface{}) }
Logger is an general RR log interface
type WithLogger ¶
type WithLogger interface {
With(keyvals ...interface{}) Logger
}
With creates a child logger and adds structured context to it
type ZapAdapter ¶
type ZapAdapter struct {
// contains filtered or unexported fields
}
func NewZapAdapter ¶
func NewZapAdapter(zapLogger *zap.Logger) *ZapAdapter
Create NewZapAdapter which uses general log interface
func (*ZapAdapter) Debug ¶
func (log *ZapAdapter) Debug(msg string, keyvals ...interface{})
func (*ZapAdapter) Error ¶
func (log *ZapAdapter) Error(msg string, keyvals ...interface{})
func (*ZapAdapter) Info ¶
func (log *ZapAdapter) Info(msg string, keyvals ...interface{})
func (*ZapAdapter) Warn ¶
func (log *ZapAdapter) Warn(msg string, keyvals ...interface{})
func (*ZapAdapter) With ¶
func (log *ZapAdapter) With(keyvals ...interface{}) Logger
type ZapLogger ¶
type ZapLogger struct {
// contains filtered or unexported fields
}
ZapLogger manages zap logger.
func (*ZapLogger) DefaultLogger ¶
DefaultLogger returns default logger.
func (*ZapLogger) NamedLogger ¶
NamedLogger returns logger dedicated to the specific channel. Similar to Named() but also reads the core params.
Click to show internal directories.
Click to hide internal directories.