log

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrEncoder added in v0.13.0

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

ErrEncoder is an io.Writer that converts all log messages into a stream of kes.ErrorEvents.

An ErrEncoder should be used when converting log messages to JSON.

func NewErrEncoder added in v0.13.0

func NewErrEncoder(w io.Writer) *ErrEncoder

NewErrEncoder returns a new ErrEncoder that writes kes.ErrorEvents to w.

func (*ErrEncoder) Write added in v0.13.0

func (w *ErrEncoder) Write(p []byte) (int, error)

Write converts p into an kes.ErrorEvent and writes its JSON representation to the underlying io.Writer.

func (*ErrEncoder) WriteString added in v0.13.0

func (w *ErrEncoder) WriteString(s string) (int, error)

WriteString converts s into an kes.ErrorEvent and writes its JSON representation to the underlying io.Writer.

type Target added in v0.13.0

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

Target groups a set of logging targets.

A message that gets written to the Target.Log will be sent to all logging targets.

func NewTarget added in v0.13.0

func NewTarget(targets ...io.Writer) *Target

NewTarget creates a new group of logging targets from the given targets. Dublicate or nil targets will be filtered out.

If no targets are provided the returned Target will discard any log messages.

func (*Target) Add added in v0.13.0

func (t *Target) Add(target io.Writer)

Add adds the given target to the set of logging targets.

It does not add the given target if it is already in the set of logging targets nor if it is nil.

func (*Target) Log added in v0.13.0

func (t *Target) Log() *log.Logger

Log returns the log.Logger that writes to all logging targets.

The output of the returned *log.Logger must not be modified directly via its SetOutput method. Instead, use the Add and Remove methods of Target.

func (*Target) Remove added in v0.13.0

func (t *Target) Remove(target io.Writer)

Remove removes the given target from the set of logging targets.

Jump to

Keyboard shortcuts

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