logs

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(ctx context.Context) logs.Logger

func RegisterWriter

func RegisterWriter(name string, writer Writer)

func With

func With(ctx context.Context, v logs.Logger)

Types

type Config

type Config struct {
	Level     string       `json:"level,omitempty" yaml:"level,omitempty"`
	Formatter string       `json:"formatter,omitempty" yaml:"formatter,omitempty"`
	Color     bool         `json:"color,omitempty" yaml:"color,omitempty"`
	Writer    WriterConfig `json:"writer,omitempty" yaml:"writer,omitempty"`
}

type Logger

type Logger interface {
	logs.Logger
	Shutdown(ctx context.Context)
}

func New

func New(name string, config Config) (v Logger, err error)

type StdErr

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

func (*StdErr) Construct

func (s *StdErr) Construct(_ WriterOptions) (err error)

func (*StdErr) Shutdown

func (s *StdErr) Shutdown(_ context.Context)

func (*StdErr) Write

func (s *StdErr) Write(p []byte) (n int, err error)

type StdOut

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

func (*StdOut) Construct

func (s *StdOut) Construct(_ WriterOptions) (err error)

func (*StdOut) Shutdown

func (s *StdOut) Shutdown(_ context.Context)

func (*StdOut) Write

func (s *StdOut) Write(p []byte) (n int, err error)

type Writer

type Writer interface {
	io.Writer
	Shutdown(ctx context.Context)
	Construct(options WriterOptions) (err error)
}

type WriterConfig

type WriterConfig struct {
	Name    string          `json:"name,omitempty" yaml:"name,omitempty"`
	Options json.RawMessage `json:"options,omitempty" yaml:"options,omitempty"`
}

type WriterOptions

type WriterOptions struct {
	Config configures.Config
}

Jump to

Keyboard shortcuts

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