log

package
v4.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Overview

Package log defines the logging interface used internally by the driver and provides default logging implementations.

Index

Constants

View Source
const (
	Bolt3   = "bolt3"
	Bolt4   = "bolt4"
	Driver  = "driver"
	Pool    = "pool"
	Router  = "router"
	Session = "session"
)

List of component names used as parameter to logger functions.

Variables

This section is empty.

Functions

func NewId

func NewId() string

NewId generates a new id atomically.

Types

type BoltLogger added in v4.3.0

type BoltLogger interface {
	LogClientMessage(context string, msg string, args ...interface{})
	LogServerMessage(context string, msg string, args ...interface{})
}

type Console

type Console struct {
	Errors bool
	Infos  bool
	Warns  bool
	Debugs bool
}

Console is a simple logger that logs to stdout/console. Turn the different log levels on/off as wished, all are off by default.

func (*Console) Debugf

func (l *Console) Debugf(name, id string, msg string, args ...interface{})

func (*Console) Error

func (l *Console) Error(name, id string, err error)

func (*Console) Infof

func (l *Console) Infof(name, id string, msg string, args ...interface{})

func (*Console) Warnf

func (l *Console) Warnf(name, id string, msg string, args ...interface{})

type ConsoleBoltLogger added in v4.3.0

type ConsoleBoltLogger struct {
}

func (*ConsoleBoltLogger) LogClientMessage added in v4.3.0

func (cbl *ConsoleBoltLogger) LogClientMessage(id, msg string, args ...interface{})

func (*ConsoleBoltLogger) LogServerMessage added in v4.3.0

func (cbl *ConsoleBoltLogger) LogServerMessage(id, msg string, args ...interface{})

type Logger

type Logger interface {
	// Error is called whenever the driver encounters an error that might
	// or might not cause a retry operation which means that all logged
	// errors are not critical. Type of err might or might not be a publicly
	// exported type. The same root cause of an error might be reported
	// more than once by different components using same or different err types.
	Error(name string, id string, err error)
	Warnf(name string, id string, msg string, args ...interface{})
	Infof(name string, id string, msg string, args ...interface{})
	Debugf(name string, id string, msg string, args ...interface{})
}

Logger is used throughout the driver for logging purposes. Driver client can implement this interface and provide an implementation upon driver creation.

All logging functions takes a name and id that corresponds to the name of the logging component and it's identity, for example "router" and "1" to indicate who is logging and what instance.

Database connections takes to form of "bolt3" and "bolt-123@192.168.0.1:7687" where "bolt3" is the name of the protocol handler in use, "bolt-123" is the databases identity of the connection on server "192.168.0.1:7687".

type Void

type Void struct{}

Logger implementation that throws away all log events.

func (Void) Debugf

func (l Void) Debugf(name, id string, msg string, args ...interface{})

func (Void) Error

func (l Void) Error(name, id string, err error)

func (Void) Infof

func (l Void) Infof(name, id string, msg string, args ...interface{})

func (Void) Warnf

func (l Void) Warnf(name, id string, msg string, args ...interface{})

Jump to

Keyboard shortcuts

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