Documentation
¶
Index ¶
- Constants
- type Logger
- func (l *Logger) DPanic(args ...interface{})
- func (l *Logger) DPanicf(template string, args ...interface{})
- func (l *Logger) DPanicw(msg string, keysAndValues ...interface{})
- func (l *Logger) Debug(args ...interface{})
- func (log *Logger) DebugInterface(msg string, v interface{})
- func (l *Logger) Debugf(template string, args ...interface{})
- func (l *Logger) Debugw(msg string, keysAndValues ...interface{})
- func (log *Logger) DisableStacktrace() *Logger
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) ErrorN(template string, args ...interface{}) error
- func (l *Logger) Errorf(template string, args ...interface{})
- func (l *Logger) Errorw(msg string, keysAndValues ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(template string, args ...interface{})
- func (l *Logger) Fatalw(msg string, keysAndValues ...interface{})
- func (log *Logger) IncreaseLevel(lvl zapcore.LevelEnabler) *Logger
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(template string, args ...interface{})
- func (l *Logger) Infow(msg string, keysAndValues ...interface{})
- func (log *Logger) Named(name string) *Logger
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) Panicf(template string, args ...interface{})
- func (l *Logger) Panicw(msg string, keysAndValues ...interface{})
- func (l *Logger) Sync() error
- func (log *Logger) Unwrap() *zap.SugaredLogger
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(template string, args ...interface{})
- func (l *Logger) Warnw(msg string, keysAndValues ...interface{})
- func (log *Logger) With(args ...interface{}) *Logger
- func (log *Logger) WithComponent(comp *core.Component) *Logger
- func (log *Logger) WithEvent(evt *core.Event) *Logger
- func (log *Logger) WithInstance(val string) *Logger
- func (log *Logger) WithPlatform(val string) *Logger
- func (log *Logger) WithPlatformComponent(val string) *Logger
- func (log *Logger) WithSource(src *core.Component) *Logger
- func (log *Logger) WithSpan(traceId, spanId string) *Logger
- func (log *Logger) WithTarget(tgt *core.Component) *Logger
Constants ¶
const ( KeyAppDeployment = "appDeployment" KeyBrokerId = "brokerId" KeyBrokerName = "brokerName" KeyComponentCommit = "componentCommit" KeyComponentId = "componentId" KeyComponentName = "componentName" KeyComponentType = "componentType" KeyController = "controller" KeyEventCategory = "eventCategory" KeyEventId = "eventId" KeyEventType = "eventType" KeyInstance = "instance" KeyPlatform = "platform" KeyPlatformComponent = "platformComponent" KeySourceBrokerId = "sourceBrokerId" KeySourceCommit = "sourceCommit" KeySourceId = "sourceId" KeySourceName = "sourceName" KeySourceType = "sourceType" KeySpanId = "spanId" KeyTargetBrokerId = "targetBrokerId" KeyTargetCommit = "targetCommit" KeyTargetId = "targetId" KeyTargetName = "targetName" KeyTargetType = "targetType" KeyTraceId = "traceId" KeyVirtualEnv = "virtualEnv" KeyWorker = "worker" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
var (
Global *Logger
)
func BuildLogger ¶
func BuildLoggerOrDie ¶
func (*Logger) DPanic ¶
func (l *Logger) DPanic(args ...interface{})
DPanic uses fmt.Sprint to construct and log a message. In console mode, the logger then panics. (See DPanicLevel for details.)
func (*Logger) DPanicf ¶
DPanicf uses fmt.Sprintf to log a templated message. In console mode, the logger then panics. (See DPanicLevel for details.)
func (*Logger) DPanicw ¶
DPanicw logs a message with some additional context. In console mode, the logger then panics. (See DPanicLevel for details.) The variadic key-value pairs are treated as they are in With.
func (*Logger) Debug ¶
func (l *Logger) Debug(args ...interface{})
Debug uses fmt.Sprint to construct and log a message.
func (*Logger) DebugInterface ¶
DebugInterface marshals the interface to indented JSON. Since this operation is expensive it is only performed if the logger is at debug level.
func (*Logger) Debugw ¶
Debugw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
When debug-level logging is disabled, this is much faster than
s.With(keysAndValues).Debug(msg)
func (*Logger) DisableStacktrace ¶
DisableStacktrace disables writing of stack traces except at panic level.
func (*Logger) Error ¶
func (l *Logger) Error(args ...interface{})
Error uses fmt.Sprint to construct and log a message.
func (*Logger) Errorw ¶
Errorw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func (*Logger) Fatal ¶
func (l *Logger) Fatal(args ...interface{})
Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
func (*Logger) Fatalw ¶
Fatalw logs a message with some additional context, then calls os.Exit. The variadic key-value pairs are treated as they are in With.
func (*Logger) IncreaseLevel ¶
func (log *Logger) IncreaseLevel(lvl zapcore.LevelEnabler) *Logger
IncreaseLevel increase the level of the logger. It has no effect if the passed in level tries to decrease the level of the logger.
func (*Logger) Info ¶
func (l *Logger) Info(args ...interface{})
Info uses fmt.Sprint to construct and log a message.
func (*Logger) Infow ¶
Infow logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func (*Logger) Panic ¶
func (l *Logger) Panic(args ...interface{})
Panic uses fmt.Sprint to construct and log a message, then panics.
func (*Logger) Panicw ¶
Panicw logs a message with some additional context, then panics. The variadic key-value pairs are treated as they are in With.
func (*Logger) Unwrap ¶
func (log *Logger) Unwrap() *zap.SugaredLogger
func (*Logger) Warn ¶
func (l *Logger) Warn(args ...interface{})
Warn uses fmt.Sprint to construct and log a message.
func (*Logger) Warnw ¶
Warnw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
func (*Logger) With ¶
With adds a variadic number of fields to the logging context. It accepts a mix of strongly-typed Field objects and loosely-typed key-value pairs. When processing pairs, the first element of the pair is used as the field key and the second as the field value.
For example,
logger.With( "hello", "world", "failure", errors.New("oh no"), Stack(), "count", 42, "user", User{Name: "alice"}, )
Note that the keys in key-value pairs should be strings. In console mode, passing a non-string key panics. In production, the logger is more forgiving: a separate error is logged, but the key-value pair is skipped and execution continues. Passing an orphaned key triggers similar behavior: panics in console mode and errors in production.