logging

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 6 Imported by: 0

README

logging

import "github.com/tfadeyi/slotalk/internal/logging"

Package logging uses the logr.Logger interface to integrate with different logging implementation for structured logging

Index

func ContextWithLogger

func ContextWithLogger(ctx context.Context, l Logger) context.Context

ContextWithLogger wraps the logr NewContext function

func IsValidLevel

func IsValidLevel(lvl string) bool

IsValidLevel returns true if the input level is one of the valid values ("info", "debug", "warn", "none")

type Logger

type Logger struct {
    logr.Logger
    *sync.Mutex
}
func LoggerFromContext
func LoggerFromContext(ctx context.Context) Logger

LoggerFromContext wraps the LoggerFromContext or creates a Zap production logger

func NewStandardLogger
func NewStandardLogger() Logger

NewStandardLogger wraps the creation of a Golang standard logger

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

Debug logs the message using the info debug level (1)

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

Info logs the message using the info log level (2)

func (*Logger) SetLevel
func (l *Logger) SetLevel(lvl string) Logger

SetLevel sets the global level against which all info logs will be compared. If this is greater than or equal to the "V" of the logger, the message will be logged. A higher value here means more logs will be written

func (*Logger) Warn
func (l *Logger) Warn(err error, keysAndValues ...interface{})

Warn logs the error using the warning log level (3)

func (*Logger) WithName
func (l *Logger) WithName(name string) Logger

Generated by gomarkdoc

Documentation

Overview

Package logging uses the logr.Logger interface to integrate with different logging implementation for structured logging

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithLogger

func ContextWithLogger(ctx context.Context, l Logger) context.Context

ContextWithLogger wraps the logr NewContext function

func IsValidLevel added in v0.0.4

func IsValidLevel(lvl string) bool

IsValidLevel returns true if the input level is one of the valid values ("info", "debug", "warn", "none")

Types

type Logger

type Logger struct {
	logr.Logger
	*sync.Mutex
}

func LoggerFromContext

func LoggerFromContext(ctx context.Context) Logger

LoggerFromContext wraps the LoggerFromContext or creates a Zap production logger

func NewStandardLogger

func NewStandardLogger() Logger

NewStandardLogger wraps the creation of a Golang standard logger

func (*Logger) Debug added in v0.0.4

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

Debug logs the message using the info debug level (1)

func (*Logger) Info added in v0.0.4

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

Info logs the message using the info log level (2)

func (*Logger) SetLevel added in v0.0.4

func (l *Logger) SetLevel(lvl string) Logger

SetLevel sets the global level against which all info logs will be compared. If this is greater than or equal to the "V" of the logger, the message will be logged. A higher value here means more logs will be written

func (*Logger) Warn added in v0.0.4

func (l *Logger) Warn(err error, keysAndValues ...interface{})

Warn logs the error using the warning log level (3)

func (*Logger) WithName added in v0.0.4

func (l *Logger) WithName(name string) Logger

Jump to

Keyboard shortcuts

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