logkf

package
v0.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyApp                = "app"
	KeyAppDeployment      = "appDeployment"
	KeyBrokerId           = "brokerId"
	KeyBrokerName         = "brokerName"
	KeyComponentApp       = "componentApp"
	KeyComponentHash      = "componentHash"
	KeyComponentId        = "componentId"
	KeyComponentName      = "componentName"
	KeyComponentType      = "componentType"
	KeyController         = "controller"
	KeyEventCategory      = "eventCategory"
	KeyEventId            = "eventId"
	KeyEventType          = "eventType"
	KeyInstance           = "instance"
	KeyPlatform           = "platform"
	KeyPlatformComponent  = "platformComponent"
	KeyReleaseManifest    = "releaseManifest"
	KeySourceApp          = "sourceApp"
	KeySourceBrokerId     = "sourceBrokerId"
	KeySourceHash         = "sourceHash"
	KeySourceId           = "sourceId"
	KeySourceName         = "sourceName"
	KeySourceType         = "sourceType"
	KeySpanId             = "spanId"
	KeyTargetApp          = "targetApp"
	KeyTargetBrokerId     = "targetBrokerId"
	KeyTargetHash         = "targetHash"
	KeyTargetId           = "targetId"
	KeyTargetName         = "targetName"
	KeyTargetType         = "targetType"
	KeyTraceId            = "traceId"
	KeyVirtualEnvironment = "virtualEnvironment"
	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 BuildLogger(format, level string) (*Logger, error)

func BuildLoggerOrDie

func BuildLoggerOrDie(format, level string) *Logger

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

func (l *Logger) DPanicf(template string, args ...interface{})

DPanicf uses fmt.Sprintf to log a templated message. In console mode, the logger then panics. (See DPanicLevel for details.)

func (*Logger) DPanicw

func (l *Logger) DPanicw(msg string, keysAndValues ...interface{})

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

func (log *Logger) DebugInterface(msg string, v interface{})

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) Debugf

func (l *Logger) Debugf(template string, args ...interface{})

Debugf uses fmt.Sprintf to log a templated message.

func (*Logger) Debugw

func (l *Logger) Debugw(msg string, keysAndValues ...interface{})

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

func (log *Logger) DisableStacktrace() *Logger

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) ErrorN

func (l *Logger) ErrorN(template string, args ...interface{}) error

ErrorN creates an error with fmt.Errorf, logs it, and returns the error.

func (*Logger) Errorf

func (l *Logger) Errorf(template string, args ...interface{})

Errorf uses fmt.Sprintf to log a templated message.

func (*Logger) Errorw

func (l *Logger) Errorw(msg string, keysAndValues ...interface{})

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) Fatalf

func (l *Logger) Fatalf(template string, args ...interface{})

Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.

func (*Logger) Fatalw

func (l *Logger) Fatalw(msg string, keysAndValues ...interface{})

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) Infof

func (l *Logger) Infof(template string, args ...interface{})

Infof uses fmt.Sprintf to log a templated message.

func (*Logger) Infow

func (l *Logger) Infow(msg string, keysAndValues ...interface{})

Infow logs a message with some additional context. The variadic key-value pairs are treated as they are in With.

func (*Logger) Named

func (log *Logger) Named(name string) *Logger

func (*Logger) Panic

func (l *Logger) Panic(args ...interface{})

Panic uses fmt.Sprint to construct and log a message, then panics.

func (*Logger) Panicf

func (l *Logger) Panicf(template string, args ...interface{})

Panicf uses fmt.Sprintf to log a templated message, then panics.

func (*Logger) Panicw

func (l *Logger) Panicw(msg string, keysAndValues ...interface{})

Panicw logs a message with some additional context, then panics. The variadic key-value pairs are treated as they are in With.

func (*Logger) Sync

func (l *Logger) Sync() error

Sync flushes any buffered log entries.

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) Warnf

func (l *Logger) Warnf(template string, args ...interface{})

Warnf uses fmt.Sprintf to log a templated message.

func (*Logger) Warnw

func (l *Logger) Warnw(msg string, keysAndValues ...interface{})

Warnw logs a message with some additional context. The variadic key-value pairs are treated as they are in With.

func (*Logger) With

func (log *Logger) With(args ...interface{}) *Logger

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.

func (*Logger) WithComponent

func (log *Logger) WithComponent(comp *core.Component) *Logger

func (*Logger) WithEvent

func (log *Logger) WithEvent(evt *core.Event) *Logger

func (*Logger) WithInstance

func (log *Logger) WithInstance(val string) *Logger

func (*Logger) WithPlatform

func (log *Logger) WithPlatform(val string) *Logger

func (*Logger) WithPlatformComponent

func (log *Logger) WithPlatformComponent(val string) *Logger

func (*Logger) WithSource

func (log *Logger) WithSource(src *core.Component) *Logger

func (*Logger) WithSpan

func (log *Logger) WithSpan(traceId, spanId string) *Logger

func (*Logger) WithTarget

func (log *Logger) WithTarget(tgt *core.Component) *Logger

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL