logging

package
v0.30.11 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DATA_DOCUMENTS = "data_documents"
View Source
const ERROR = "error"
View Source
const INPUT_TYPE = "input_type"
View Source
const JUDGEMENT_KEY = "judgement_key"
View Source
const JUDGEMENT_NAME = "judgement_name"
View Source
const MODULES = "modules"
View Source
const PACKAGE = "package"
View Source
const PATH = "path"
View Source
const POLICY_TYPE = "policy_type"
View Source
const RESOURCE_ID = "resource_id"
View Source
const RESOURCE_TYPE = "resource_type"

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Trace(ctx context.Context, msg string)
	Debug(ctx context.Context, msg string)
	Info(ctx context.Context, msg string)
	Warn(ctx context.Context, msg string)
	Error(ctx context.Context, msg string)
	WithError(err error) Logger
	WithField(name string, value interface{}) Logger
}

Logger defines a simple interface for the pluggable logging in the policy engine

var NopLogger Logger = NewZeroLogger(zerolog.Nop())

NopLogger does not write any messages. It can be used to disable logging.

var StdErrLogger Logger = NewZeroLogger(zerolog.Logger{}.
	Level(zerolog.GlobalLevel()).
	Output(os.Stderr).
	With().Timestamp().Logger())

StdErrLogger writes structured log messages to stderr

func NewZeroLogger

func NewZeroLogger(zl zerolog.Logger) Logger

type ZeroLogger

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

DefaultLogger is an implementation of the Logger interface that uses zerolog internally.

func (*ZeroLogger) Debug

func (l *ZeroLogger) Debug(_ context.Context, msg string)

func (*ZeroLogger) Error

func (l *ZeroLogger) Error(_ context.Context, msg string)

func (*ZeroLogger) Info

func (l *ZeroLogger) Info(_ context.Context, msg string)

func (*ZeroLogger) Trace

func (l *ZeroLogger) Trace(_ context.Context, msg string)

func (*ZeroLogger) Warn

func (l *ZeroLogger) Warn(_ context.Context, msg string)

func (*ZeroLogger) WithError

func (l *ZeroLogger) WithError(err error) Logger

func (*ZeroLogger) WithField

func (l *ZeroLogger) WithField(name string, value interface{}) Logger

Jump to

Keyboard shortcuts

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