logbasics

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 4 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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. Preferably errors should bubble up to the caller, so only if that is not possible, this method should be used.

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