logtypes

package
v0.0.0-...-baa064a Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: LGPL-3.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLine

type LogLine struct {
	// Timestamp defines the time at which an entry was created.
	// It is best practice to sent this with the entry, but it is nullable.
	// In case Timestamp is nil, the database will default it to `now()`.
	Timestamp *time.Time `db:"occurred" json:"timestamp"`

	// ServiceName is determined from the API key and a server-only variable.
	ServiceName string `db:"servicename" json:"-"`

	// Severity indicates the severity of the entry. Required.
	// Levels are represented by the integers 0-6.
	// This package includes all severity levels als constants.
	Severity *Severity `db:"severity" json:"severity" validate:"min=0,max=6"`

	// Message is the message contents of the log. Required.
	Message string `db:"message" json:"message" validate:"required"`

	// ExtraInformation can be used to add extra information in a JSON format. Optional.
	// The JSON should be in the form of an object, not an array or primitive.
	ExtraInformation map[string]interface{} `db:"fields" json:"extrainfo"`
}

LogLine is the most important entity and represents a log entry.

func (LogLine) String

func (ll LogLine) String() string

type Severity

type Severity uint8

Severity is the type used to indicate the severity of a log entry. Under the hood, integers between 0 and 6 are used.

const (
	// SeverityPanic is used when the process is ungracefully exited after logging.
	SeverityPanic Severity = 0

	// SeverityFatal is used when the process is gracefully exited after logging.
	SeverityFatal Severity = 1

	// SeverityError is used for failures that do not cause the program to exit.
	SeverityError Severity = 2

	// SeverityWarning is used to warn at issues, but not considered failures.
	SeverityWarning Severity = 3

	//SeverityInfo is used to save any noteworthy information.
	SeverityInfo Severity = 4

	// SeverityDebug is used for useful debugging information.
	SeverityDebug Severity = 5

	// SeverityTrace is used for very low level logs, usually during development.
	SeverityTrace Severity = 6
)

Jump to

Keyboard shortcuts

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