log

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 0 Imported by: 67

Documentation

Overview

Package log provides a logging interface for use in this library.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultLogger added in v0.10.0

type DefaultLogger struct {
}

DefaultLogger is enabled when no consuming clients provide a logger to the server/cache subsystem

func NewDefaultLogger added in v0.10.0

func NewDefaultLogger() *DefaultLogger

NewDefaultLogger creates a DefaultLogger which is a no-op to maintain current functionality

func (*DefaultLogger) Debugf added in v0.10.0

func (l *DefaultLogger) Debugf(format string, args ...interface{})

Debugf logs a message at level debug on the standard logger.

func (*DefaultLogger) Errorf added in v0.10.0

func (l *DefaultLogger) Errorf(format string, args ...interface{})

Errorf logs a message at level error on the standard logger.

func (*DefaultLogger) Infof added in v0.10.0

func (l *DefaultLogger) Infof(format string, args ...interface{})

Infof logs a message at level info on the standard logger.

func (*DefaultLogger) Warnf added in v0.10.0

func (l *DefaultLogger) Warnf(format string, args ...interface{})

Warnf logs a message at level warn on the standard logger.

type Logger

type Logger interface {
	// Debugf logs a formatted debugging message.
	Debugf(format string, args ...interface{})

	// Infof logs a formatted informational message.
	Infof(format string, args ...interface{})

	// Warnf logs a formatted warning message.
	Warnf(format string, args ...interface{})

	// Errorf logs a formatted error message.
	Errorf(format string, args ...interface{})
}

Logger interface for reporting informational and warning messages.

type LoggerFuncs added in v0.9.6

type LoggerFuncs struct {
	DebugFunc func(string, ...interface{})
	InfoFunc  func(string, ...interface{})
	WarnFunc  func(string, ...interface{})
	ErrorFunc func(string, ...interface{})
}

LoggerFuncs implements the Logger interface, allowing the caller to specify only the logging functions that are desired.

Example
logger := log.Logger{}

xdsLogger := LoggerFuncs{
	DebugFunc: logger.Printf,
	InfoFunc:  logger.Printf,
	WarnFunc:  logger.Printf,
	ErrorFunc: logger.Printf,
}

xdsLogger.Debugf("debug")
xdsLogger.Infof("info")
xdsLogger.Warnf("warn")
xdsLogger.Errorf("error")
Output:

func (LoggerFuncs) Debugf added in v0.9.6

func (f LoggerFuncs) Debugf(format string, args ...interface{})

Debugf logs a formatted debugging message.

func (LoggerFuncs) Errorf added in v0.9.6

func (f LoggerFuncs) Errorf(format string, args ...interface{})

Errorf logs a formatted error message.

func (LoggerFuncs) Infof added in v0.9.6

func (f LoggerFuncs) Infof(format string, args ...interface{})

Infof logs a formatted informational message.

func (LoggerFuncs) Warnf added in v0.9.6

func (f LoggerFuncs) Warnf(format string, args ...interface{})

Warnf logs a formatted warning message.

Jump to

Keyboard shortcuts

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