logs

package
v1.2.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: 8 Imported by: 3

Documentation

Index

Constants

View Source
const (
	TextConsoleFormatter         = ConsoleFormatter("text")
	TextColorfulConsoleFormatter = ConsoleFormatter("text_colorful")
	JsonConsoleFormatter         = ConsoleFormatter("json")
)
View Source
const (
	Stdout = ConsoleWriterOutType("stdout")
	Stderr = ConsoleWriterOutType("stderr")
	Stdmix = ConsoleWriterOutType("stdout_stderr")
)
View Source
const (
	Debug = Level("debug")
	Info  = Level("info")
	Warn  = Level("warn")
	Error = Level("error")
)

Variables

This section is empty.

Functions

func Load

func Load(ctx context.Context) logs.Logger

func With

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

Types

type Config

type Config struct {
	Level           Level                `json:"level,omitempty" yaml:"level,omitempty"`
	Formatter       ConsoleFormatter     `json:"formatter,omitempty" yaml:"formatter,omitempty"`
	Console         ConsoleWriterOutType `json:"console,omitempty" yaml:"console,omitempty"`
	DisableConsole  bool                 `json:"disableConsole,omitempty" yaml:"disableConsole,omitempty"`
	Consumes        int                  `json:"consumes,omitempty" yaml:"consumes,omitempty"`
	Buffer          int                  `json:"buffer,omitempty" yaml:"buffer,omitempty"`
	SendTimeout     string               `json:"sendTimeout,omitempty" yaml:"sendTimeout,omitempty"`
	ShutdownTimeout string               `json:"shutdownTimeout,omitempty" yaml:"shutdownTimeout,omitempty"`
	Writers         []WriterConfig       `json:"writers,omitempty" yaml:"writer,omitempty"`
}

func (*Config) GetWriter added in v1.2.0

func (config *Config) GetWriter(name string) (writer configures.Config, err error)

type ConsoleFormatter added in v1.2.0

type ConsoleFormatter string

func (ConsoleFormatter) Code added in v1.2.0

func (formatter ConsoleFormatter) Code() logs.ConsoleWriterFormatter

type ConsoleWriterOutType added in v1.2.0

type ConsoleWriterOutType string

func (ConsoleWriterOutType) Code added in v1.2.0

type Level added in v1.2.0

type Level string

func (Level) Code added in v1.2.0

func (level Level) Code() logs.Level

type Logger

type Logger interface {
	logs.Logger
}

func New

func New(config Config, writers []Writer) (v Logger, err error)

type Writer

type Writer interface {
	logs.Writer
	Name() string
	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"`
}

func (WriterConfig) Config added in v1.2.0

func (writer WriterConfig) Config() (v configures.Config, err error)

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