log

package
v5.19.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

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

Index

Constants

View Source
const (
	// ERROR is the level that error messages are written
	ERROR Level = 1
	// WARNING is the level that warning messages are written
	WARNING = 2
	// INFO is the level that info messages are written
	INFO = 3
	// DEBUG is the level that debug messages are written
	DEBUG = 4
)
View Source
const (
	Bolt3   = "bolt3"
	Bolt4   = "bolt4"
	Bolt5   = "bolt5"
	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

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

func BoltToConsole added in v5.17.0

func BoltToConsole() BoltLogger

BoltToConsole returns a BoltLogger implementation that writes to stdout.

type Console deprecated

type Console = console

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

Deprecated: use log.ToConsole() instead.

type ConsoleBoltLogger deprecated

type ConsoleBoltLogger = consoleBoltLogger

Deprecated: use log.BoltToConsole() instead.

type Level added in v5.17.0

type Level int

Level is the type that default logging implementations use for available log levels

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 ...any)
	Infof(name string, id string, msg string, args ...any)
	Debugf(name string, id string, msg string, args ...any)
}

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

func ToConsole added in v5.17.0

func ToConsole(level Level) Logger

ToConsole returns a simple logger that logs to stdout/console.

level is the minimum log level that will be logged.

func ToVoid added in v5.17.0

func ToVoid() Logger

ToVoid returns a Logger implementation that throws away all log events.

type Void deprecated

type Void = void

Void is a Logger implementation that throws away all log events.

Deprecated: use log.ToVoid() instead.

Jump to

Keyboard shortcuts

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