logg

package
v0.0.0-...-d430ac9 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 4 Imported by: 46

Documentation

Overview

Package logg provides some convenience functions on top of the "log" package from the stdlib. It always uses the stdlib's standard logger.

The functions in this package work like log.Println() or like log.Printf() depending on whether arguments are passed after the message string:

import (
	"log"
	"github.com/sapcc/go-bits/logg"
)

//The following two are equivalent:
logg.Info("starting up")
std_log.Println("INFO: starting up")

//The following two are equivalent:
logg.Info("listening on port %d", port)
std_log.Printf("INFO: listening on port %d\n", port)

Index

Constants

This section is empty.

Variables

View Source
var (
	// ShowDebug can be set to true to enable the display of debug logs.
	ShowDebug = false
)

Functions

func Debug

func Debug(msg string, args ...any)

Debug logs a debug message if debug logging is enabled.

func Error

func Error(msg string, args ...any)

Error logs a non-fatal error.

func Fatal

func Fatal(msg string, args ...any)

Fatal logs a fatal error and terminates the program.

func Info

func Info(msg string, args ...any)

Info logs an informational message.

func Other

func Other(level, msg string, args ...any)

Other logs a message with a custom log level.

func SetLogger

func SetLogger(l *stdlog.Logger)

SetLogger allows to define custom logger

Types

This section is empty.

Jump to

Keyboard shortcuts

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