log

package
v0.0.0-...-80ab217 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT Imports: 1 Imported by: 7

Documentation

Overview

Package log defines the MQTT log interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, logger Interface) context.Context

NewContext returns a new context that contains the logger

Types

type F

type F map[string]interface{}

func (F) Fields

func (f F) Fields() map[string]interface{}

type Fielder

type Fielder interface {
	Fields() map[string]interface{}
}

Fielder is the interface for anything that can have fields.

func Fields

func Fields(f map[string]interface{}) Fielder

Fields returns a Fielder

type Interface

type Interface interface {
	Debug(msg string)
	Info(msg string)
	Warn(msg string)
	Error(msg string)
	Fatal(msg string)
	Debugf(msg string, v ...interface{})
	Infof(msg string, v ...interface{})
	Warnf(msg string, v ...interface{})
	Errorf(msg string, v ...interface{})
	Fatalf(msg string, v ...interface{})
	WithField(string, interface{}) Interface
	WithFields(Fielder) Interface
	WithError(error) Interface
}

Interface is the interface for logging.

var Noop Interface = &noop{}

Noop logger

func FromContext

func FromContext(ctx context.Context) Interface

FromContext calls log.FromContext

Jump to

Keyboard shortcuts

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