logbasics

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

This package provides a global logger instance that is used by other packages within go-apiops. The default is to discard any logging. It uses go-logr/logr. The logger instance can be set by calling SetLogger.

General behaviour; * Errors will not be logged, but returned instead. Logging those is up to the caller. * The library does not use verbosity level 0 * level 1 is used for informational messages (when calling `Info`) * level 2 is used for debug messages (when calling `Debug`)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, keysAndValues ...interface{})

Debug logs a debug message ("info" at verbosity level 2).

func Error

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

Error logs an error message.

func GetLogger

func GetLogger() logr.Logger

GetLogger returns the logger instance to use for logging.

func Info

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

Info logs an informational message ("info" at verbosity level 1).

func Initialize

func Initialize(flags int, verbosity int)

Initialize creates and sets a logger instance to log to stderr. Any follow up calls to Initialize will ignore the parameters and set the logger to the initially created instance. see https://pkg.go.dev/log#pkg-constants for the flag values

func SetLogger

func SetLogger(l *logr.Logger)

SetLogger set the logger instance to use for logging. Setting it to nil will disable logging.

Types

This section is empty.

Jump to

Keyboard shortcuts

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