logur: logur.dev/logur/examples Index | Examples | Files

package example

import "logur.dev/logur/examples"

Code:

logger := logur.NoopLogger{} // choose an actual implementation

bugsnag.New(bugsnag.Configuration{
    Logger: logur.NewErrorPrintLogger(logger),
})

Code:

logger := logur.NoopLogger{} // choose an actual implementation

log.With(kitintegration.New(logger), "key", "value")

Code:

logger := logur.NoopLogger{} // choose an actual implementation

grpclog.SetLoggerV2(grpcintegration.New(logger))

Code:

logger := logur.NoopLogger{} // choose an actual implementation

_ = mysql.SetLogger(logur.NewErrorPrintLogger(logger))

Code:

logger := logur.NoopLogger{} // choose an actual implementation
clientLogger := logur.NewErrorPrintLogger(logger)

rollbar.SetLogger(clientLogger)
// OR
notifier := rollbar.New("token", "environment", "version", "host", "root")
notifier.SetLogger(clientLogger)

Index

Examples

Package Files

logger.go

type Logger Uses

type Logger interface {
    Trace(msg string, fields ...map[string]interface{})
    Debug(msg string, fields ...map[string]interface{})
    Info(msg string, fields ...map[string]interface{})
    Warn(msg string, fields ...map[string]interface{})
    Error(msg string, fields ...map[string]interface{})

    // WithFields annotates a logger with some context and it as a new instance.
    WithFields(fields map[string]interface{}) Logger
}

Logger is the fundamental interface for all log operations.

type LoggerAdapter Uses

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

LoggerAdapter wraps a logur logger and exposes it under a custom interface.

func NewLoggerAdapter Uses

func NewLoggerAdapter(logger logur.Logger) *LoggerAdapter

NewLoggerAdapter returns a new Logger instance.

func (*LoggerAdapter) Debug Uses

func (l *LoggerAdapter) Debug(msg string, fields ...map[string]interface{})

Debug logs a debug event.

func (*LoggerAdapter) Error Uses

func (l *LoggerAdapter) Error(msg string, fields ...map[string]interface{})

Error logs an error event.

func (*LoggerAdapter) Info Uses

func (l *LoggerAdapter) Info(msg string, fields ...map[string]interface{})

Info logs an info event.

func (*LoggerAdapter) Trace Uses

func (l *LoggerAdapter) Trace(msg string, fields ...map[string]interface{})

Trace logs a trace event.

func (*LoggerAdapter) Warn Uses

func (l *LoggerAdapter) Warn(msg string, fields ...map[string]interface{})

Warn logs a warning event.

func (*LoggerAdapter) WithFields Uses

func (l *LoggerAdapter) WithFields(fields map[string]interface{}) Logger

WithFields annotates a logger with some context and it as a new instance.

Package example imports 1 packages (graph). Updated 2020-01-24. Refresh now. Tools for package owners.