Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Encoding string OutputPaths []string Level string InitialFields map[string]interface{} }
Config for a logger
type ILogger ¶
type ILogger interface { // With returns a logger based off the root logger and decorates it with the given context and arguments. With(ctx context.Context, args ...interface{}) *Logger // Debug uses fmt.Sprint to construct and log a message at DEBUG level Debug(args ...interface{}) // Info uses fmt.Sprint to construct and log a message at INFO level Info(args ...interface{}) // Error uses fmt.Sprint to construct and log a message at ERROR level Error(args ...interface{}) // Debugf uses fmt.Sprintf to construct and log a message at DEBUG level Debugf(format string, args ...interface{}) // Infof uses fmt.Sprintf to construct and log a message at INFO level Infof(format string, args ...interface{}) // Errorf uses fmt.Sprintf to construct and log a message at ERROR level Errorf(format string, args ...interface{}) // Sync synchronises logging Sync() error // Print uses fmt.Sprint to construct and log a message at DEBUG level Print(v ...interface{}) }
ILogger interface
type Logger ¶
type Logger struct {
*zap.SugaredLogger
}
Logger struct
func NewByDefault ¶
func NewByDefault() *Logger
NewByDefault creates a new logger using the default configuration.
func NewWithZap ¶
NewWithZap creates a new logger using the preconfigured zap logger.
func (*Logger) With ¶
With returns a logger based off the root logger and decorates it with the given context and arguments.
If the context contains request ID and/or correlation ID information (recorded via WithRequestID() and WithCorrelationID()), they will be added to every log message generated by the new logger.
The arguments should be specified as a sequence of name, value pairs with names being strings. The arguments will also be added to every log message generated by the logger.