go-control-plane: github.com/envoyproxy/go-control-plane/pkg/log Index | Examples | Files

package log

import "github.com/envoyproxy/go-control-plane/pkg/log"

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

Index

Examples

Package Files

log.go

type Logger Uses

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 Uses

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.

Code:

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")

func (LoggerFuncs) Debugf Uses

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

Debugf logs a formatted debugging message.

func (LoggerFuncs) Errorf Uses

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

Errorf logs a formatted error message.

func (LoggerFuncs) Infof Uses

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

Infof logs a formatted informational message.

func (LoggerFuncs) Warnf Uses

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

Warnf logs a formatted warning message.

Package log is imported by 9 packages. Updated 2020-06-30. Refresh now. Tools for package owners.