Documentation ¶
Index ¶
- Variables
- func AddConfiguredLoggers(config Config)
- func Configure(config Config)
- func GetKey(name string) art.Key
- func GetLoggers() art.Tree
- func InitSink(u *url.URL) (zap.Sink, error)
- func Load(config interface{}) error
- func NewService() (service.Service, error)
- func SetLevel(level Level, names ...string)
- type Config
- type Debug
- type Errors
- type Level
- type Log
- func (l *Log) DPanic(args ...interface{})
- func (l *Log) DPanicf(template string, args ...interface{})
- func (l *Log) DPanicw(msg string, keysAndValues ...interface{})
- func (l *Log) Debug(args ...interface{})
- func (l *Log) Debugf(template string, args ...interface{})
- func (l *Log) Debugw(msg string, keysAndValues ...interface{})
- func (l *Log) Error(args ...interface{})
- func (l *Log) Errorf(template string, args ...interface{})
- func (l *Log) Errorw(msg string, keysAndValues ...interface{})
- func (l *Log) Fatal(args ...interface{})
- func (l *Log) Fatalf(template string, args ...interface{})
- func (l *Log) Fatalw(msg string, keysAndValues ...interface{})
- func (l *Log) Info(args ...interface{})
- func (l *Log) Infof(template string, args ...interface{})
- func (l *Log) Infow(msg string, keysAndValues ...interface{})
- func (l *Log) Panic(args ...interface{})
- func (l *Log) Panicf(template string, args ...interface{})
- func (l *Log) Panicw(msg string, keysAndValues ...interface{})
- func (l *Log) SetLevel(level Level)
- func (l *Log) Warn(args ...interface{})
- func (l *Log) Warnf(template string, args ...interface{})
- func (l *Log) Warnw(msg string, keysAndValues ...interface{})
- type Logger
- type LoggerBuilder
- type LoggerConfig
- func (c *LoggerConfig) Build() LoggerConfig
- func (c *LoggerConfig) GetLogger() *Log
- func (c *LoggerConfig) GetSinkURLs() []SinkURL
- func (c *LoggerConfig) GetZapConfig() zp.Config
- func (c *LoggerConfig) SetDevelopment(development bool) LoggerBuilder
- func (c *LoggerConfig) SetECEncodeDuration(encodeDuration zc.DurationEncoder) LoggerBuilder
- func (c *LoggerConfig) SetECEncodeLevel(encodeLevel zc.LevelEncoder) LoggerBuilder
- func (c *LoggerConfig) SetECEncoderCaller(callerKey string, encoderCaller zc.CallerEncoder) LoggerBuilder
- func (c *LoggerConfig) SetECLevelKey(levelKey string) LoggerBuilder
- func (c *LoggerConfig) SetECLineEnding(lineEnding string) LoggerBuilder
- func (c *LoggerConfig) SetECMsgKey(msgKey string) LoggerBuilder
- func (c *LoggerConfig) SetECStackTraceKey(stackTraceKey string) LoggerBuilder
- func (c *LoggerConfig) SetECTimeEncoder(timeEncoder zc.TimeEncoder) LoggerBuilder
- func (c *LoggerConfig) SetECTimeKey(timeKey string) LoggerBuilder
- func (c *LoggerConfig) SetEncoding(encoding string) LoggerBuilder
- func (c *LoggerConfig) SetErrorOutputPaths(errorOutputPaths []string) LoggerBuilder
- func (c *LoggerConfig) SetLevel(level Level) LoggerBuilder
- func (c *LoggerConfig) SetName(names ...string) LoggerBuilder
- func (c *LoggerConfig) SetOutputPaths(outputPaths []string) LoggerBuilder
- func (c *LoggerConfig) SetSinkURLs(sinkURLs []SinkURL) LoggerBuilder
- type Server
- type Service
- type Sink
- type SinkInfo
- type SinkType
- type SinkURL
Constants ¶
This section is empty.
Variables ¶
var ( // Sinks : Sinks = map[string]Sink{} )
Functions ¶
func AddConfiguredLoggers ¶
func AddConfiguredLoggers(config Config)
AddConfiguredLoggers adds configured loggers
func Configure ¶
func Configure(config Config)
Configure configures logging with the given configuration
func NewService ¶
NewService returns a new device Service
Types ¶
type Config ¶
type Config struct { Loggers map[string]struct { Encoding string `yaml:"encoding"` Level string `yaml:"level"` Sink string `yaml:"sink"` } `yaml:"loggers"` Sinks map[string]struct { Key string `yaml:"key"` Type string `yaml:"type"` Topic string `yaml:"topic"` URI string `yaml:"uri"` } `yaml:"sinks"` }
Config logging configuration
type Level ¶
type Level int
Level :
const ( // DebugLevel logs a message at debug level DebugLevel Level = iota // InfoLevel logs a message at info level InfoLevel // WarnLevel logs a message at warning level WarnLevel // ErrorLevel logs a message at error level ErrorLevel // FatalLevel logs a message, then calls os.Exit(1). FatalLevel // PanicLevel logs a message, then panics. PanicLevel // DPanicLevel logs at PanicLevel; otherwise, it logs at ErrorLevel DPanicLevel // EmptyLevel : EmptyLevel )
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log :
func (*Log) DPanic ¶
func (l *Log) DPanic(args ...interface{})
DPanic logs a message at DPanic level on the sugar logger
func (*Log) Debug ¶
func (l *Log) Debug(args ...interface{})
Debug logs a message at Debug level on the sugar logger.
func (*Log) Error ¶
func (l *Log) Error(args ...interface{})
Error logs a message at Error level on the sugar logger
func (*Log) Fatal ¶
func (l *Log) Fatal(args ...interface{})
Fatal logs a message at Fatal level on the sugar logger
func (*Log) Info ¶
func (l *Log) Info(args ...interface{})
Info logs a message at Info level on the sugar logger
func (*Log) Panic ¶
func (l *Log) Panic(args ...interface{})
Panic logs a message at Panic level on the sugar logger
func (*Log) Warn ¶
func (l *Log) Warn(args ...interface{})
Warn logs a message at Warn level on the sugar logger
type Logger ¶
type Logger interface { Debug(...interface{}) Debugf(template string, args ...interface{}) Debugw(msg string, keysAndValues ...interface{}) Info(...interface{}) Infof(template string, args ...interface{}) Infow(msg string, keysAndValues ...interface{}) Error(...interface{}) Errorf(template string, args ...interface{}) Errorw(msg string, keysAndValues ...interface{}) Fatal(...interface{}) Fatalf(template string, args ...interface{}) Fatalw(msg string, keysAndValues ...interface{}) Panic(...interface{}) Panicf(template string, args ...interface{}) Panicw(msg string, keysAndValues ...interface{}) DPanic(...interface{}) DPanicf(template string, args ...interface{}) DPanicw(msg string, keysAndValues ...interface{}) Warn(...interface{}) Warnf(template string, args ...interface{}) Warnw(msg string, keysAndValues ...interface{}) SetLevel(level Level) }
Logger represents an abstract logging interface.
type LoggerBuilder ¶
type LoggerBuilder interface { SetLevel(Level) LoggerBuilder SetEncoding(string) LoggerBuilder SetDevelopment(bool) LoggerBuilder SetOutputPaths([]string) LoggerBuilder SetErrorOutputPaths([]string) LoggerBuilder SetSinkURLs([]SinkURL) LoggerBuilder //SetInitialFields(Fields) LoggerBuilder SetECLevelKey(string) LoggerBuilder SetECMsgKey(string) LoggerBuilder SetECTimeKey(string) LoggerBuilder SetECStackTraceKey(string) LoggerBuilder SetECLineEnding(string) LoggerBuilder SetECEncodeLevel(zc.LevelEncoder) LoggerBuilder SetECTimeEncoder(zc.TimeEncoder) LoggerBuilder SetName(...string) LoggerBuilder SetECEncodeDuration(zc.DurationEncoder) LoggerBuilder SetECEncoderCaller(string, zc.CallerEncoder) LoggerBuilder Build() LoggerConfig }
LoggerBuilder log configuration builder interface
type LoggerConfig ¶
type LoggerConfig struct {
// contains filtered or unexported fields
}
LoggerConfig log config structure
func (*LoggerConfig) Build ¶
func (c *LoggerConfig) Build() LoggerConfig
Build builds a custom log configuration
func (*LoggerConfig) GetSinkURLs ¶
func (c *LoggerConfig) GetSinkURLs() []SinkURL
GetSinkURLs gets sink urls
func (*LoggerConfig) GetZapConfig ¶
func (c *LoggerConfig) GetZapConfig() zp.Config
GetZapConfig gets zap configuration
func (*LoggerConfig) SetDevelopment ¶
func (c *LoggerConfig) SetDevelopment(development bool) LoggerBuilder
SetDevelopment sets log development
func (*LoggerConfig) SetECEncodeDuration ¶
func (c *LoggerConfig) SetECEncodeDuration(encodeDuration zc.DurationEncoder) LoggerBuilder
SetECEncodeDuration sets log encoder config encode duration
func (*LoggerConfig) SetECEncodeLevel ¶
func (c *LoggerConfig) SetECEncodeLevel(encodeLevel zc.LevelEncoder) LoggerBuilder
SetECEncodeLevel sets log encoder config encode level
func (*LoggerConfig) SetECEncoderCaller ¶
func (c *LoggerConfig) SetECEncoderCaller(callerKey string, encoderCaller zc.CallerEncoder) LoggerBuilder
SetECEncoderCaller sets log encoder config encoder caller
func (*LoggerConfig) SetECLevelKey ¶
func (c *LoggerConfig) SetECLevelKey(levelKey string) LoggerBuilder
SetECLevelKey sets log encoder config level key
func (*LoggerConfig) SetECLineEnding ¶
func (c *LoggerConfig) SetECLineEnding(lineEnding string) LoggerBuilder
SetECLineEnding sets log encoder config line ending
func (*LoggerConfig) SetECMsgKey ¶
func (c *LoggerConfig) SetECMsgKey(msgKey string) LoggerBuilder
SetECMsgKey sets log encoder config message key
func (*LoggerConfig) SetECStackTraceKey ¶
func (c *LoggerConfig) SetECStackTraceKey(stackTraceKey string) LoggerBuilder
SetECStackTraceKey sets log encoder config start trace key
func (*LoggerConfig) SetECTimeEncoder ¶
func (c *LoggerConfig) SetECTimeEncoder(timeEncoder zc.TimeEncoder) LoggerBuilder
SetECTimeEncoder sets log encoder config time encoder
func (*LoggerConfig) SetECTimeKey ¶
func (c *LoggerConfig) SetECTimeKey(timeKey string) LoggerBuilder
SetECTimeKey sets log encoder config time key
func (*LoggerConfig) SetEncoding ¶
func (c *LoggerConfig) SetEncoding(encoding string) LoggerBuilder
SetEncoding sets log encoding
func (*LoggerConfig) SetErrorOutputPaths ¶
func (c *LoggerConfig) SetErrorOutputPaths(errorOutputPaths []string) LoggerBuilder
SetErrorOutputPaths sets log error output paths
func (*LoggerConfig) SetLevel ¶
func (c *LoggerConfig) SetLevel(level Level) LoggerBuilder
SetLevel sets log level
func (*LoggerConfig) SetName ¶
func (c *LoggerConfig) SetName(names ...string) LoggerBuilder
SetName sets encoder config name key
func (*LoggerConfig) SetOutputPaths ¶
func (c *LoggerConfig) SetOutputPaths(outputPaths []string) LoggerBuilder
SetOutputPaths sets log output paths
func (*LoggerConfig) SetSinkURLs ¶
func (c *LoggerConfig) SetSinkURLs(sinkURLs []SinkURL) LoggerBuilder
SetSinkURLs sets sink urls
type Server ¶
type Server struct { }
Server implements the logging gRPC service
func (*Server) SetDebug ¶
func (s *Server) SetDebug(ctx context.Context, req *logging.SetDebugModeRequest) (*logging.SetDebugModeResponse, error)
SetDebug enable/disable debug mode for logging package
func (*Server) SetLevel ¶
func (s *Server) SetLevel(ctx context.Context, req *logging.SetLevelRequest) (*logging.SetLevelResponse, error)
SetLevel implements SetLevel rpc function to set a logger level
type SinkInfo ¶
type SinkInfo struct {
// contains filtered or unexported fields
}
SinkInfo sink information
func ContainSink ¶
ContainSink checks a sink is in the list of sinks