logz

package
v19.0.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 18 Imported by: 0

README

The logz package

The logz package should be used to re-use existing log attributes (slog.Attr) and helpers. New log fields can be added in case they don't drag in any new dependency. In case the log field requires a new dependency, you should define the log field name in fields.go and define the slog.Attr helper in the module where it's used.

Log field names

Log field names must be in snake_case.

Documentation

Index

Constants

View Source
const (
	AgentConfig = "agent_config"
	ApplyEvent  = "apply_event"

	VertexID     = "vid"
	FromVertexID = "from_vid"
	ToVertexID   = "to_vid"
	ArcType      = "arc_type"
	VidRoot      = "vid_root"
	VidWasRoot   = "vid_was_root"
)
View Source
const (
	AttributesFieldName = "attrs"
)

Variables

This section is empty.

Functions

func AbortCause

func AbortCause[T ~string](cause T) slog.Attr

func AbortRetryAttempt

func AbortRetryAttempt[T ~int | ~int32](n T) slog.Attr

func ActivityName

func ActivityName(name string) slog.Attr

func ActivityTaskID

func ActivityTaskID(id fmt.Stringer) slog.Attr

func AgentKey

func AgentKey(agentKey api.AgentKey) slog.Attr

func AnyJSONValue

func AnyJSONValue(key string, value any) slog.Attr

func Attempt

func Attempt[T ~int | ~int32](attempt T) slog.Attr

func Backoff

func Backoff(d time.Duration) slog.Attr

func CIJobID

func CIJobID(id int64) slog.Attr

func CommitID

func CommitID(commitID string) slog.Attr

func ConsumerGroup

func ConsumerGroup(consumerGroup string) slog.Attr

func ConsumerName

func ConsumerName(consumerName string) slog.Attr

func Disposition

func Disposition[T ~string](disposition T) slog.Attr

func DurationInMilliseconds

func DurationInMilliseconds(duration time.Duration) slog.Attr

func Error

func Error(err error) slog.Attr

func EventHandler

func EventHandler(handler string) slog.Attr

func EventType

func EventType(eventType string) slog.Attr

func ExecutionResult

func ExecutionResult[T ~string](result T) slog.Attr

func FenceID

func FenceID[T ~int64](id T) slog.Attr

func FireAtDB

func FireAtDB(t time.Time) slog.Attr

func FlowScript

func FlowScript(script string) slog.Attr

func FullReconciliationInterval

func FullReconciliationInterval(interval time.Duration) slog.Attr

func GRPCMethod

func GRPCMethod(method string) slog.Attr

func GRPCService

func GRPCService(service string) slog.Attr

func GV

func GV(gvr schema.GroupVersion) slog.Attr

func GVR

func GitRepositoryURL

func GitRepositoryURL(url string) slog.Attr

func IdentityKey

func IdentityKey(key string) slog.Attr

func InstanceID

func InstanceID[T ~int64](id T) slog.Attr

func InventoryName

func InventoryName(name string) slog.Attr

func InventoryNamespace

func InventoryNamespace(namespace string) slog.Attr

func IsScriptPrint

func IsScriptPrint() slog.Attr

func IsWebSocket

func IsWebSocket(isWebSocket bool) slog.Attr

func JSONValue

func JSONValue(key string, value any) slog.Attr

func K8sObjectName

func K8sObjectName(name string) slog.Attr

func K8sObjectNamespace

func K8sObjectNamespace(name string) slog.Attr

func K8sObjectNsAndName

func K8sObjectNsAndName(o metav1.Object) slog.Attr

func LabelSelector

func LabelSelector(selector string) slog.Attr

func LastConnectedAt

func LastConnectedAt(timestamp time.Time) slog.Attr

func LastSeenSequenceID

func LastSeenSequenceID[T ~int | ~int32 | ~int64](id T) slog.Attr

func LazyValue

func LazyValue(key string, val func() slog.Value) slog.Attr

func ListenerName

func ListenerName(name string) slog.Attr

func LoadedEventCount

func LoadedEventCount[T ~int | ~int32 | ~int64](n T) slog.Attr

func MaxAttempts

func MaxAttempts[T ~int | ~int32](n T) slog.Attr

func ModuleName

func ModuleName(name string) slog.Attr

ModuleName defines the field for logging either NGitLab-kas or agentk module name.

func Msg

func Msg(msg string) slog.Attr

func NetAddress

func NetAddress(listenAddress string) slog.Attr

func NetAddressFromAddr

func NetAddressFromAddr(addr net.Addr) slog.Attr

func NetNetwork

func NetNetwork(listenNetwork string) slog.Attr

func NetNetworkFromAddr

func NetNetworkFromAddr(addr net.Addr) slog.Attr

func NumberOfEventHandlers

func NumberOfEventHandlers(n int) slog.Attr

func ObjectKey

func ObjectKey(objKey string) slog.Attr

func OwnedShards

func OwnedShards[T ~int | ~int32 | ~int64](n T) slog.Attr

func PartialReconciliationInterval

func PartialReconciliationInterval(interval time.Duration) slog.Attr

func PayloadSizeInBytes

func PayloadSizeInBytes(size int) slog.Attr

func PeerCount

func PeerCount[T ~int | ~int32 | ~int64](n T) slog.Attr

func PendingFutureCount

func PendingFutureCount[T ~int | ~int32 | ~int64](n T) slog.Attr

func PodName

func PodName(podName string) slog.Attr

func PodNamespace

func PodNamespace(podNamespace string) slog.Attr

func PodStatus

func PodStatus(podStatus string) slog.Attr

func ProjectID

func ProjectID(projectID string) slog.Attr

ProjectID is the human-readable GitLab project path (e.g. gitlab-org/gitlab).

func ProjectsToReconcile

func ProjectsToReconcile(p sets.Set[string]) slog.Attr

func ProtoJSONValue

func ProtoJSONValue(key string, value proto.Message) slog.Attr

func Reason

func Reason(reason string) slog.Attr

func RecoveredCount

func RecoveredCount[T ~int | ~int32 | ~int64](n T) slog.Attr

func RedisKey

func RedisKey(key []byte) slog.Attr

func RemovedHashKeys

func RemovedHashKeys(n int) slog.Attr

func RemovedHashKeysIn

func RemovedHashKeysIn(hashName string, n int) slog.Attr

func Replayed

func Replayed() slog.Attr

func RequestID

func RequestID(requestID string) slog.Attr

func ResponseHeaders

func ResponseHeaders(h http.Header) slog.Attr

func ScheduleCount

func ScheduleCount[T ~int | ~int32 | ~int64](n T) slog.Attr

func ScheduledTaskID

func ScheduledTaskID(id fmt.Stringer) slog.Attr

func SecondsAgo

func SecondsAgo(duration time.Duration) slog.Attr

func ShardID

func ShardID[T ~int32](id T) slog.Attr

func SignalID

func SignalID(id fmt.Stringer) slog.Attr

func SignalName

func SignalName(name string) slog.Attr

func SignalType

func SignalType(st fmt.Stringer) slog.Attr

func StatusCode

func StatusCode(code int32) slog.Attr

func StringSet

func StringSet(key string, val sets.Set[string]) slog.Attr

func Strings

func Strings(key string, val []string) slog.Attr

func TargetNamespace

func TargetNamespace(namespace string) slog.Attr

func TargetShards

func TargetShards[T ~int | ~int32 | ~int64](n T) slog.Attr

func TerminalCause

func TerminalCause[T ~string](cause T) slog.Attr

func TokenLimit

func TokenLimit(limit uint64) slog.Attr

func Topic

func Topic(topic string) slog.Attr

func TotalShards

func TotalShards[T ~int | ~int32 | ~int64](n T) slog.Attr

func TraceID

func TraceID(traceID trace.TraceID) slog.Attr

func TraceIDFromContext

func TraceIDFromContext(ctx context.Context) slog.Attr

func TrimSourceFilePath

func TrimSourceFilePath(attr slog.Attr) slog.Attr

func TunnelsByAgent

func TunnelsByAgent(numTunnels int) slog.Attr

func U64Count

func U64Count(count uint64) slog.Attr

U64Count defines a counter field Use for any integer counters.

func URL

func URL(url string) slog.Attr

func URLPath

func URLPath(url string) slog.Attr

func URLPathPrefix

func URLPathPrefix(urlPrefix string) slog.Attr

func VulnerabilitiesCount

func VulnerabilitiesCount(n int) slog.Attr

func WatchID

func WatchID(id string) slog.Attr

func WorkflowAlreadyExists

func WorkflowAlreadyExists(v bool) slog.Attr

func WorkflowExecutionState

func WorkflowExecutionState(state fmt.Stringer) slog.Attr

func WorkflowID

func WorkflowID(id fmt.Stringer) slog.Attr

func WorkflowTaskID

func WorkflowTaskID(id fmt.Stringer) slog.Attr

func WorkspaceDataCount

func WorkspaceDataCount(count int) slog.Attr

func WorkspaceName

func WorkspaceName(name string) slog.Attr

func WorkspaceNamespace

func WorkspaceNamespace(namespace string) slog.Attr

Types

type LockedWriter

type LockedWriter struct {
	io.Writer
	// contains filtered or unexported fields
}

LockedWriter serializes Write calls.

func (*LockedWriter) Write

func (w *LockedWriter) Write(data []byte) (int, error)

type LogValuerFunc

type LogValuerFunc func() slog.Value

func (LogValuerFunc) LogValue

func (f LogValuerFunc) LogValue() slog.Value

Jump to

Keyboard shortcuts

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