tracelog

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package tracelog provides a logger for debugging and tracing This logger will not print anything, unless TRACE_LEVEL is at least 1

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(ctx context.Context) logr.Logger

Logger returns the logger from the context, the server injects a logger into each request.

func LoggerFlags

func LoggerFlags(pf *flag.FlagSet, argToEnv map[string]string)

LoggerFlags adds to viper flags

func NewLogger

func NewLogger() logr.Logger

NewLogger creates a new logger with our setup. It only prints messages below TraceLevel(). The starting point for derived loggers is 1. So in the default configuration, TRACE_LEVEL=0, V(1), nothing is printed. TRACE_LEVEL=1 shows simple log statements, everything above like `details`, or V(3) needs a higher TRACE_LEVEL.

func TraceLevel

func TraceLevel() int

TraceLevel returns the trace-level argument

func WithLogger added in v0.1.1

func WithLogger(ctx context.Context, log logr.Logger) context.Context

WithLogger returns a copy of the context with the given logger

Types

type CtxLoggerKey

type CtxLoggerKey struct{}

Jump to

Keyboard shortcuts

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