auloggingapi

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: MIT Imports: 1 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextAwareLoggingImplementation

type ContextAwareLoggingImplementation interface {
	// Log using TRACE level (-1).
	Trace() LeveledLoggingImplementation

	// Log using DEBUG level (0).
	Debug() LeveledLoggingImplementation

	// Log using INFO level (1).
	Info() LeveledLoggingImplementation

	// Log using WARN level (2).
	Warn() LeveledLoggingImplementation

	// Log using ERROR level (3).
	Error() LeveledLoggingImplementation

	// Log using FATAL level (4) and exit the application.
	//
	// Note that once application startup is over, this is usually very bad practice.
	Fatal() LeveledLoggingImplementation

	// Log using PANIC level (5), print a stack trace, and exit the application.
	//
	// Note that this is usually very bad practice.
	Panic() LeveledLoggingImplementation
}

type LeveledLoggingImplementation

type LeveledLoggingImplementation interface {
	// Add an error to the log message and keep going.
	//
	// This does not actually log anything, you need to follow it up by Print or Printf.
	WithErr(err error) LeveledLoggingImplementation

	// Add an additional key-value-pair to the log message and keep going.
	//
	// This does not actually log anything, you need to follow it up by Print or Printf.
	With(key string, value string) LeveledLoggingImplementation

	// Finalize the log entry and emit it, including all arguments in the message.
	Print(v ...interface{})

	// Finalize the log entry and emit it, using a format string for the message.
	Printf(format string, v ...interface{})
}

type LogEventCallbackFunc added in v0.3.0

type LogEventCallbackFunc func(ctx context.Context, level string, message string, err error, additionalFields map[string]string)

LogEventCallbackFunc is the type of a callback function you can provide to receive a callback for every log event.

level is set to "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL"

type LoggingImplementation

type LoggingImplementation interface {
	// Ctx returns a context aware logger.
	//
	// You should use this if you have a context.
	//
	// Behaviour is implementation dependent, usually the logger will be taken from the context.
	Ctx(ctx context.Context) ContextAwareLoggingImplementation

	// NoCtx returns a context aware logger using a blank context.
	//
	// Use this if you do not have a context (but if it's your own code, you really should).
	NoCtx() ContextAwareLoggingImplementation
}

LoggingImplementation is the top level entry point to our logging API.

Note: access to the singleton instance is provided in the Logger global variable.

See convenience.go for some examples of how to use these interfaces.

type RequestIdRetrieverFunc added in v0.1.1

type RequestIdRetrieverFunc func(ctx context.Context) string

RequestIdRetrieverFunc is the type of a function used to obtain a request id from a context

Note: access to the singleton instance is provided in the Logger global variable.

used for tracing integration

Jump to

Keyboard shortcuts

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