logging

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package logging is the internal home for the implementation of our public facing bitbucket.org/amotus/telemetry.logging package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(opts *Options) error

Init is the internal implementation for our public facing init.

Types

type Config

type Config struct {
	Format      format.Enum
	Level       slog.Leveler
	Writer      io.Writer
	Name        string
	WithColors  bool
	WithSources bool
}

Config is an internal fully resolved representation of our logging configuration.

See Options for the partial not yet resolved version of this configuration.

type EnvNames

type EnvNames struct {
	Format  string
	Level   string
	Name    string
	Colors  string
	Sources string
}

EnvNames is an internal struct holding the name of the various environment variables used by our logging package.

type Option

type Option = func(opts *Options)

Option is the internal implementation for our public facing Option.

type Options

type Options struct {
	Default     *Config
	Env         *EnvNames
	Format      *format.Enum
	Level       slog.Leveler
	Writer      io.Writer
	Name        *string
	WithColors  *bool
	WithSources *bool
}

Options is the internal representation of the options provided to our public facing Init function.

The information provided here will be later resolved into a Config.

See NewDefaultOptions to create instances of this type.

func NewDefaultOptions

func NewDefaultOptions() *Options

NewDefaultOptions creates a valid default Options instance.

func (*Options) Apply

func (o *Options) Apply(opts ...Option)

Apply takes a list of Option and apply those to the various members of our Options instance.

Jump to

Keyboard shortcuts

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