ctx

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 7 Imported by: 25

Documentation

Overview

Package ctx implements log context convenience functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(k string, b bool) logger.Field

Bool returns a boolean context field.

func Bytes

func Bytes(k string, p []byte) logger.Field

Bytes returns a byte slice context field.

func Caller added in v2.2.0

func Caller(k string) logger.Field

Caller returns a caller string context field.

func Duration

func Duration(k string, d time.Duration) logger.Field

Duration returns a duration context field.

func Err added in v2.4.0

func Err(err error) logger.Field

Err returns an error context field with the key set to "error".

func Error

func Error(k string, err error) logger.Field

Error returns an error context field.

func Float32

func Float32(k string, f float32) logger.Field

Float32 returns a float32 context field.

func Float64

func Float64(k string, f float64) logger.Field

Float64 returns a float64 context field.

func Int

func Int(k string, i int) logger.Field

Int returns an int context field.

func Int16

func Int16(k string, i int16) logger.Field

Int16 returns an int16 context field.

func Int32

func Int32(k string, i int32) logger.Field

Int32 returns an int32 context field.

func Int64

func Int64(k string, i int64) logger.Field

Int64 returns an int64 context field.

func Int8

func Int8(k string, i int8) logger.Field

Int8 returns an int8 context field.

func Interface

func Interface(k string, v interface{}) logger.Field

Interface returns an interface context field.

func Ints

func Ints(k string, a []int) logger.Field

Ints returns an int slice context field.

func Stack added in v2.2.0

func Stack(k string) logger.Field

Stack return a stack string context field.

func Str

func Str(k, s string) logger.Field

Str returns a string context field.

func Strs

func Strs(k string, s []string) logger.Field

Strs returns a string slice context field.

func Time

func Time(k string, t time.Time) logger.Field

Time returns a time context field.

func TraceID added in v2.5.0

func TraceID(k string, span Span) logger.Field

TraceID returns an open telemetry trace ID context field.

func Uint

func Uint(k string, i uint) logger.Field

Uint returns a uint context field.

func Uint16

func Uint16(k string, i uint16) logger.Field

Uint16 returns a uint16 context field.

func Uint32

func Uint32(k string, i uint32) logger.Field

Uint32 returns a uint32 context field.

func Uint64

func Uint64(k string, i uint64) logger.Field

Uint64 returns a uint64 context field.

func Uint8

func Uint8(k string, i uint8) logger.Field

Uint8 returns a uint8 context field.

Types

type Span added in v2.5.0

type Span interface {
	IsRecording() bool
	SpanContext() trace.SpanContext
}

Span represents an open telemetry span.

Jump to

Keyboard shortcuts

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