common

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope interface {
	Kind() Type

	Component() string
	Level() LogLevel
	Message() string

	// TimeStampString returns the current envelope's timestamp as a string.
	TimeStampString() string

	GetEmbeddedData() (json.RawMessage, error)
}

type Level

type Level = int

type LogLevel

type LogLevel interface {
	IsDebug() bool
	IsError() bool
	IsFatal() bool
	IsInfo() bool
	IsTrace() bool
	IsWarn() bool

	String() string
}

type Type

type Type = int

Type indicates the type of log line, e.g. an "error" line.

const (
	// TypeMessage lines do not have extra attributes. They consist solely of
	// the baseline attributes with a `msg` attribute conveying the presentable
	// information.
	TypeMessage Type = iota

	// TypeDataIncluded represents lines that have a `data` field which contains
	// serialized JSON. Such lines may have other attributes, but the `data`
	// attribute is the primary focus.
	TypeDataIncluded

	// TypeEmbeddedDataIncluded represents lines that have inlined serialized
	// JSON. For example, a log was likely generated like:
	//
	//   log.info(`some ${JSON.stringify(data)} data`)
	//
	TypeEmbeddedDataIncluded

	// TypeError represents lines who's extra attributes represent error metadata.
	TypeError

	// TypeExtraAttributes log lines that have added attributes, but are
	// otherwise a regular [TypeMessage] log line.
	TypeExtraAttributes
)

Jump to

Keyboard shortcuts

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