log

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionalInfo

type AdditionalInfo struct {
	Key   string
	Value interface{}
}

AdditionalInfo is a key-value pair that will be added to the log

type Context

type Context struct {
	// Module is the name of the module this data is coming from.
	// When coming from a generated client, it is `asyncapi`
	Module string

	// Provider is the name of the provider this data is coming from.
	// When coming from generated code, it is `app`, `client` or `broker`
	Provider string

	// Action is the name of the action this data is coming from.
	// When coming from generated code, it is the name of the channel
	Action string

	// Operation is the name of the operation this data is coming from.
	// When coming from generated code, it is `subscribe`, `publish`, `wait-for`, etc
	Operation string

	// Message is the message that has been sent or received
	Message any

	// CorrelationID is the correlation ID of the message
	CorrelationID string
}

Context will contain information about the context where the log is called This is interesting if you're implementing your own logger

type ECS

type ECS struct{}

func NewECS

func NewECS() ECS

NewECS creates a new ECS logger

func (ECS) Error

func (logger ECS) Error(ctx Context, msg string, info ...AdditionalInfo)

func (ECS) Info

func (logger ECS) Info(ctx Context, msg string, info ...AdditionalInfo)

type Logger

type Logger interface {
	// Info logs information based on a message and key-value elements
	Info(ctx Context, msg string, info ...AdditionalInfo)

	// Error logs error based on a message and key-value elements
	Error(ctx Context, msg string, info ...AdditionalInfo)
}

Logger is the interface that must be implemented by a logger

type Silent

type Silent struct {
}

Silent is a logger that does not log anything

func (Silent) Error

func (s Silent) Error(_ Context, _ string, _ ...AdditionalInfo)

Error logs error based on a message and key-value elements

func (Silent) Info

func (s Silent) Info(_ Context, _ string, _ ...AdditionalInfo)

Info logs information based on a message and key-value elements

Jump to

Keyboard shortcuts

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