logging

package
v0.0.0-...-bfe00b6 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package logging provides a logging adapter that bridges to the original source code logging system

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithLogger

func ContextWithLogger(ctx context.Context, logger Logger) context.Context

ContextWithLogger returns a new context containing logger.

func Critical

func Critical(msg string, fields ...Field)

Critical logs at critical level

func Criticalf

func Criticalf(format string, args ...interface{})

Criticalf logs at critical level with format

func Debug

func Debug(msg string, fields ...Field)

Debug logs at debug level

func Debugf

func Debugf(format string, args ...interface{})

Debugf logs at debug level with format

func Error

func Error(msg string, fields ...Field)

Error logs at error level

func Errorf

func Errorf(format string, args ...interface{})

Errorf logs at error level with format

func Fatal

func Fatal(msg string, fields ...Field)

Fatal logs at fatal level (maps to Critical; agent Critical does not exit)

func Fatalf

func Fatalf(format string, args ...interface{})

Fatalf logs at fatal level with format

func Info

func Info(msg string, fields ...Field)

Info logs at info level

func Infof

func Infof(format string, args ...interface{})

Infof logs at info level with format

func Panic

func Panic(msg string, fields ...Field)

Panic logs at panic level then panics

func Panicf

func Panicf(format string, args ...interface{})

Panicf logs at panic level with format then panics

func Warn

func Warn(msg string, fields ...Field)

Warn logs at warn level

func Warnf

func Warnf(format string, args ...interface{})

Warnf logs at warn level with format

Types

type Field

type Field struct {
	Key   string
	Value interface{}
}

Field represents a structured logging field

func Any

func Any(key string, value interface{}) Field

Any creates a field with any value

func Bool

func Bool(key string, value bool) Field

Bool creates a bool field

func Duration

func Duration(key string, value time.Duration) Field

Duration creates a duration field

func ErrorField

func ErrorField(err error) Field

ErrorField creates an error field

func Int

func Int(key string, value int) Field

Int creates an int field

func Int32

func Int32(key string, value int32) Field

Int64 creates an int32 field

func Int64

func Int64(key string, value int64) Field

Int64 creates an int64 field

func String

func String(key, value string) Field

String creates a string field

func Strings

func Strings(key string, values []string) Field

Strings creates a string slice field

type Logger

type Logger interface {
	Debug(msg string, fields ...Field)
	Debugf(format string, args ...interface{})
	Info(msg string, fields ...Field)
	Infof(format string, args ...interface{})
	Warn(msg string, fields ...Field)
	Warnf(format string, args ...interface{})
	Error(msg string, fields ...Field)
	Errorf(format string, args ...interface{})
	With(fields ...Field) Logger
}

Logger interface that mimics original logger behavior

func FromContext

func FromContext(ctx context.Context) Logger

FromContext returns the logger from ctx, or a new logger if none exists.

Jump to

Keyboard shortcuts

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