log

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientTransport

func ClientTransport(origin runtime.ClientTransport) runtime.ClientTransport

ClientTransport returns OpenAPI client wrapper for propagating request id.

func New

func New(cfg Config, serviceName, version, env, host string) zerolog.Logger

func SlackWriter

func SlackWriter(webhookURL string, level zerolog.Level) zerolog.LevelWriter

func StdoutWriter

func StdoutWriter(pretty bool) io.Writer

StdoutWriter default writer.

Types

type Config

type Config struct {
	Level           string `yaml:"level" env:"LOGGER_LEVEL" env-default:"debug" env-description:"Enabled verbose logging"`
	Pretty          bool   `` /* 131-byte string literal not displayed */
	SlackWebhookURL string `yaml:"slack_webhook_url" env:"LOGGER_SLACK_WEBHOOK_URL" env-description:"Internal variable"`
}

type JobLog

type JobLog struct {
	ID        int64
	CreatedAt time.Time
	Level     int16
	JobID     string
	Message   string
	Metadata  map[string]any
}

type JobLogger

type JobLogger struct {
	// contains filtered or unexported fields
}

func NewJobLogger

func NewJobLogger(store *repository.Store) *JobLogger

func (*JobLogger) ListByJobID

func (l *JobLogger) ListByJobID(ctx context.Context, jobID string, limit int64) ([]*JobLog, error)

func (*JobLogger) Log

func (l *JobLogger) Log(ctx context.Context, level Level, jobID, msg string, metadata map[string]any)

type Level

type Level uint8
const (
	Emergency Level = iota
	Alert
	Critical
	Error
	Warning
	Notice
	Info
	Debug
)

func (Level) String

func (l Level) String() string

Jump to

Keyboard shortcuts

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