logging

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldLevel   = "level"
	FieldMessage = "msg"
	FieldTime    = "time"
)
View Source
const (
	JobField    string = "job"
	SubsysField string = "subsystem"
	SpanField   string = "span"
)
View Source
const HumanFormatterDateFormat = time.RFC3339

Variables

Functions

func GetLogger added in v0.3.0

func GetLogger(ctx context.Context, subsys Subsystem) logger.Logger

func OutletsFromConfig

func OutletsFromConfig(in config.LoggingOutletEnumList) (*logger.Outlets, error)

func ParseOutlet added in v0.2.0

func ParseOutlet(in config.LoggingOutletEnum) (o logger.Outlet, level logger.Level, err error)

func WithInherit added in v0.3.0

func WithInherit(ctx, inheritFrom context.Context) context.Context

func WithInjectedField added in v0.3.0

func WithInjectedField(ctx context.Context, field string, value interface{}) context.Context

func WithLoggers added in v0.3.0

func WithLoggers(ctx context.Context, loggers SubsystemLoggers) context.Context

Types

type EntryFormatter

type EntryFormatter interface {
	SetMetadataFlags(flags MetadataFlags)
	Format(e *logger.Entry) ([]byte, error)
}

type HumanFormatter

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

func (*HumanFormatter) Format

func (f *HumanFormatter) Format(e *logger.Entry) (out []byte, err error)

func (*HumanFormatter) SetIgnoreFields

func (f *HumanFormatter) SetIgnoreFields(ignore []string)

func (*HumanFormatter) SetMetadataFlags

func (f *HumanFormatter) SetMetadataFlags(flags MetadataFlags)

type JSONFormatter

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

func (*JSONFormatter) Format

func (f *JSONFormatter) Format(e *logger.Entry) ([]byte, error)

func (*JSONFormatter) SetMetadataFlags

func (f *JSONFormatter) SetMetadataFlags(flags MetadataFlags)

type LogfmtFormatter

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

func (*LogfmtFormatter) Format

func (f *LogfmtFormatter) Format(e *logger.Entry) ([]byte, error)

func (*LogfmtFormatter) SetMetadataFlags

func (f *LogfmtFormatter) SetMetadataFlags(flags MetadataFlags)

type MetadataFlags

type MetadataFlags int64
const (
	MetadataTime MetadataFlags = 1 << iota
	MetadataLevel
	MetadataColor

	MetadataNone MetadataFlags = 0
	MetadataAll  MetadataFlags = ^0
)

type NoFormatter

type NoFormatter struct{}

func (NoFormatter) Format

func (f NoFormatter) Format(e *logger.Entry) ([]byte, error)

func (NoFormatter) SetMetadataFlags

func (f NoFormatter) SetMetadataFlags(flags MetadataFlags)

type Subsystem

type Subsystem string
const (
	SubsysMeta         Subsystem = "meta"
	SubsysJob          Subsystem = "job"
	SubsysReplication  Subsystem = "repl"
	SubsysEndpoint     Subsystem = "endpoint"
	SubsysPruning      Subsystem = "pruning"
	SubsysSnapshot     Subsystem = "snapshot"
	SubsysHooks        Subsystem = "hook"
	SubsysTransport    Subsystem = "transport"
	SubsysTransportMux Subsystem = "transportmux"
	SubsysRPC          Subsystem = "rpc"
	SubsysRPCControl   Subsystem = "rpc.ctrl"
	SubsysRPCData      Subsystem = "rpc.data"
	SubsysZFSCmd       Subsystem = "zfs.cmd"
	SubsysTraceData    Subsystem = "trace.data"
	SubsysPlatformtest Subsystem = "platformtest"
)

type SubsystemLoggers added in v0.3.0

type SubsystemLoggers map[Subsystem]logger.Logger

func GetLoggers added in v0.3.0

func GetLoggers(ctx context.Context) SubsystemLoggers

func SubsystemLoggersWithUniversalLogger added in v0.3.0

func SubsystemLoggersWithUniversalLogger(l logger.Logger) SubsystemLoggers

type SyslogOutlet

type SyslogOutlet struct {
	Formatter     EntryFormatter
	RetryInterval time.Duration
	Facility      syslog.Priority
	// contains filtered or unexported fields
}

func (*SyslogOutlet) WriteEntry

func (o *SyslogOutlet) WriteEntry(entry logger.Entry) error

type TCPOutlet

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

func NewTCPOutlet

func NewTCPOutlet(formatter EntryFormatter, network, address string, tlsConfig *tls.Config, retryInterval time.Duration) *TCPOutlet

func (*TCPOutlet) Close

func (h *TCPOutlet) Close()

FIXME: use this method

func (*TCPOutlet) WriteEntry

func (h *TCPOutlet) WriteEntry(e logger.Entry) error

type WriterOutlet

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

func (WriterOutlet) WriteEntry

func (h WriterOutlet) WriteEntry(entry logger.Entry) error

Directories

Path Synopsis
package trace provides activity tracing via ctx through Tasks and Spans
package trace provides activity tracing via ctx through Tasks and Spans

Jump to

Keyboard shortcuts

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