format

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewGCPCloudLogging added in v0.2.4

func MustNewGCPCloudLogging(params GCPCloudLoggingLogFormatterParams) *gcpCloudLoggingLogFormatter

MustNewGCPCloudLogging creates a new GCP Cloud Logging LogFormatter. It panics if any error is found.

func NewDefault

func NewDefault() *defaultLogFormatter

NewDefault creates a new default LogFormatter.

func NewGCPCloudLogging

func NewGCPCloudLogging(params GCPCloudLoggingLogFormatterParams) (*gcpCloudLoggingLogFormatter, error)

NewGCPCloudLogging creates a new GCP Cloud Logging LogFormatter.

Types

type GCPCloudLoggingLogFormatterParams added in v0.2.4

type GCPCloudLoggingLogFormatterParams struct {
	ProjectID          string
	ApplicationName    string
	ApplicationVersion string
}

GCPCloudLoggingLogFormatterParams encapsulates necessary parameters to construct a GCP Cloud Logging LogFormatter.

type LogAttribute

type LogAttribute string

LogAttribute represents an information to be extracted from the context and included into the log.

const (
	// LogAttributeRootError defines the name of the RooError attribute attached into logs.
	LogAttributeRootError LogAttribute = "root_error"

	// LogAttributeErrorKind defines the name of the ErrorKind attribute attached into logs.
	LogAttributeErrorKind LogAttribute = "err_kind"

	// LogAttributeErrorCode defines the name of the ErrorCode attribute attached into logs.
	LogAttributeErrorCode LogAttribute = "err_code"
)

type LogAttributeSet

type LogAttributeSet map[LogAttribute]bool

LogAttributeSet is a set of LogAttributes.

DefaultGRPCServerAttributeSet defines some useful LogAttributes usually used in gRPC Servers context.

func (LogAttributeSet) Add added in v0.2.6

Add creates a new LogAttributeSet with the given LogAttribute attached.

func (LogAttributeSet) Merge added in v0.2.6

Merge merges the given LogAttributeSet into the existing one and returns a copy of the result.

type LogInput

type LogInput struct {
	Level      string
	Message    string
	Err        error
	Payload    any
	Attributes LogAttributeSet
	Timestamp  time.Time
}

LogInput is the input given to a LogFormatter that is used to produce log payload.

Jump to

Keyboard shortcuts

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