log

package
v0.0.0-...-30d97dc Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

This package contains helpers to make the logging awesome. In particular, here you can find a pretty logger and a log tee, which outputs logs to multiple sources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyToLog

func CopyToLog(log logr.Logger, r io.Reader) error

CopyToLog splits a reader by newlines and emits log entries.

func CopyToLogNoError

func CopyToLogNoError(log logr.Logger, r io.Reader)

CopyToLogNoError emits log entries from a reader. Any error during read will be logged.

func CopyToLogPrefix

func CopyToLogPrefix(log logr.Logger, r io.Reader, prefix string) error

CopyToLogPrefix splits a reader by newlines and emits log entries with a prefix.

func CopyToLogPrefixNoError

func CopyToLogPrefixNoError(log logr.Logger, r io.Reader, prefix string)

CopyToLogPrefixNoError emits log entries from a reader with a prefix. Any error during read will be logged.

func FancyLog

func FancyLog(e genericr.Entry) string

FancyLog is a logging function for genericr which prints a format which is nice to use for CI output.

func LogClose

func LogClose(log logr.Logger, c io.Closer, msg string)

LogClose closes a Closer and logs any errors which occur.

Types

type Tee

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

func NewTee

func NewTee(loggers ...logr.Logger) *Tee

NewTee creates a new tee logger.

func (*Tee) Enabled

func (t *Tee) Enabled() bool

Enabled returns true if the log is enabled. (Tee is always enabled.)

func (*Tee) Error

func (t *Tee) Error(err error, msg string, keysAndValues ...interface{})

Error records an error in the log.

func (*Tee) Info

func (t *Tee) Info(msg string, keysAndValues ...interface{})

Info prints a message to the log.

func (*Tee) V

func (t *Tee) V(level int) logr.Logger

V creates a new logger with the verbosity set to level.

func (*Tee) WithName

func (t *Tee) WithName(name string) logr.Logger

WithName creates a new logger with the given log name set.

func (*Tee) WithValues

func (t *Tee) WithValues(keysAndValues ...interface{}) logr.Logger

WithValues creates a new logger with the given values set.

Jump to

Keyboard shortcuts

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