logger

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: Apache-2.0, MIT Imports: 6 Imported by: 70

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CDebug

func CDebug(ctx context.Context, msg ...interface{})

func CDebugf

func CDebugf(ctx context.Context, msgfmt string, args ...interface{})

func CError

func CError(ctx context.Context, msg ...interface{})

func CErrorf

func CErrorf(ctx context.Context, msgfmt string, args ...interface{})

func CInfo

func CInfo(ctx context.Context, msg ...interface{})

func CInfof

func CInfof(ctx context.Context, msgfmt string, args ...interface{})

func CWarn

func CWarn(ctx context.Context, msg ...interface{})

func CWarnf

func CWarnf(ctx context.Context, msgfmt string, args ...interface{})

func Debug

func Debug(msg ...interface{})

func Debugf

func Debugf(msgfmt string, args ...interface{})

func Error

func Error(msg ...interface{})

func Errorf

func Errorf(msgfmt string, args ...interface{})

func Info

func Info(msg ...interface{})

func Infof

func Infof(msgfmt string, args ...interface{})

func Set

func SetLevel

func SetLevel(name string) error

func Warn

func Warn(msg ...interface{})

func Warnf

func Warnf(msgfmt string, args ...interface{})

Types

type FormattingFunction added in v0.2.0

type FormattingFunction func(msgfmt string, args ...interface{})

type LogContext

type LogContext interface {
	NewContext(key, value string) LogContext
	AddIndent(indent string) LogContext

	Info(msg ...interface{})
	Debug(msg ...interface{})
	Warn(msg ...interface{})
	Error(msg ...interface{})

	Infof(msgfmt string, args ...interface{})
	Debugf(msgfmt string, args ...interface{})
	Warnf(msgfmt string, args ...interface{})
	Errorf(msgfmt string, args ...interface{})
}

func Get

func Get(ctx context.Context) LogContext

func New

func New() LogContext

func NewContext

func NewContext(key, value string) LogContext

func WithLogger

func WithLogger(ctx context.Context, key, value string) (context.Context, LogContext)

type OptionalSingletonMessage added in v0.2.0

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

func NewOptionalSingletonMessage added in v0.2.0

func NewOptionalSingletonMessage(function FormattingFunction, msg string, args ...interface{}) *OptionalSingletonMessage

NewOptionalSingletonMessage creates a new message outputer with a singleton section/header message that is printed before the first regular output, if there is such an output

func (*OptionalSingletonMessage) Default added in v0.2.0

func (this *OptionalSingletonMessage) Default(msg string, args ...interface{})

Default outputs a given default message if Once has never been called and disables the standard Once message

func (*OptionalSingletonMessage) Enforce added in v0.2.0

func (this *OptionalSingletonMessage) Enforce(msg string, args ...interface{})

Enforce always outputs the given message and omits further default output (explicit via method Default or implicit via method Once) without checking whether this is the first call

func (*OptionalSingletonMessage) IsPending added in v0.2.0

func (this *OptionalSingletonMessage) IsPending() bool

IsPending returns whether the header/section message is still pending

func (*OptionalSingletonMessage) Once added in v0.2.0

func (this *OptionalSingletonMessage) Once()

Once outputs the configured message the first time it is called

func (*OptionalSingletonMessage) Out added in v0.2.0

func (this *OptionalSingletonMessage) Out(msg string, args ...interface{})

Out outputs a message after calling Once to ensure a header/section message

func (*OptionalSingletonMessage) Reset added in v0.2.0

func (this *OptionalSingletonMessage) Reset()

Reset resets the done flag (

func (*OptionalSingletonMessage) ResetWith added in v0.2.0

func (this *OptionalSingletonMessage) ResetWith(msg string, args ...interface{})

ResetWith restarts the object with a new message

Jump to

Keyboard shortcuts

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