log

package
v0.0.0-...-4aa9c25 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package log provides logging utilities for the tracer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(fmt string, a ...interface{})

Debug prints the given message if the level is LevelDebug.

func DebugEnabled

func DebugEnabled() bool

DebugEnabled returns true if debug log messages are enabled. This can be used in extremely hot code paths to avoid allocating the ...interface{} argument.

func Error

func Error(format string, a ...interface{})

Error reports an error. Errors get aggregated and logged periodically. The default is once per minute or once every POBP_LOGGING_RATE number of seconds.

func Flush

func Flush()

Flush flushes and resets all aggregated errors to the logger.

func Info

func Info(fmt string, a ...interface{})

Info prints an informational message.

func SetLevel

func SetLevel(lvl Level)

SetLevel sets the given lvl for logging.

func UseLogger

func UseLogger(l pobptrace.Logger) (undo func())

UseLogger sets l as the active logger and returns a function to restore the previous logger. The return value is mostly useful when testing.

func Warn

func Warn(fmt string, a ...interface{})

Warn prints a warning message.

Types

type DiscardLogger

type DiscardLogger struct{}

DiscardLogger discards every call to Log().

func (DiscardLogger) Log

func (d DiscardLogger) Log(msg string)

Log implements pobptrace.Logger.

type Level

type Level int

Level specifies the logging level that the log package prints at.

const (
	// LevelDebug represents debug level messages.
	LevelDebug Level = iota
	// LevelWarn represents warning and errors.
	LevelWarn
)

type RecordLogger

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

RecordLogger records every call to Log() and makes it available via Logs().

func (*RecordLogger) Log

func (r *RecordLogger) Log(msg string)

Log implements pobptrace.Logger.

func (*RecordLogger) Logs

func (r *RecordLogger) Logs() []string

Logs returns the ordered list of logs recorded by the logger.

Jump to

Keyboard shortcuts

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