log

package
v0.0.21-0...-ce50be3 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Severity

type Severity int

Severity represents a log record severity (also known as log level). Smaller numerical values correspond to less severe log records (such as debug events), larger numerical values correspond to more severe log records (such as errors and critical events). Wrap over https://pkg.go.dev/go.opentelemetry.io/otel/log#Severity

const (
	// NONE represents an unset Severity.
	NONE Severity = iota // UNDEFINED

	// A fine-grained debugging log record. Typically disabled in default
	// configurations.
	TRACE
	TRACE2
	TRACE3
	TRACE4

	// A debugging log record.
	DEBUG
	DEBUG2
	DEBUG3
	DEBUG4

	// An informational log record. Indicates that an event happened.
	INFO
	INFO2
	INFO3
	INFO4

	// A warning log record. Not an error but is likely more important than an
	// informational event.
	WARN
	WARN2
	WARN3
	WARN4

	// An error log record. Something went wrong.
	ERROR
	ERROR2
	ERROR3
	ERROR4

	// A fatal log record such as application or system crash.
	FATAL
	FATAL2
	FATAL3
	FATAL4
)

func (Severity) MarshalJSON

func (v Severity) MarshalJSON() ([]byte, error)

MarshalJSON implements encoding/json.Marshaler by quoting the output of [Level.String].

func (Severity) MarshalText

func (v Severity) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler by calling [Level.String].

func (Severity) String

func (v Severity) String() string

String returns a name for the level. If the level has a name, then that name in uppercase is returned. If the level is between named values, then an integer is appended to the uppercased name. Examples:

LevelWarn.String() => "WARN"
(LevelInfo+2).String() => "INFO+2"

func (*Severity) UnmarshalJSON

func (v *Severity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements encoding/json.Unmarshaler It accepts any string produced by [Level.MarshalJSON], ignoring case. It also accepts numeric offsets that would result in a different string on output. For example, "Error-8" would marshal as "INFO".

func (*Severity) UnmarshalText

func (v *Severity) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler. It accepts any string produced by [Level.MarshalText], ignoring case. It also accepts numeric offsets that would result in a different string on output. For example, "Error-8" would marshal as "INFO".

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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