Documentation ¶
Overview ¶
Package log defines the logging interface used internally by the driver and provides default logging implementations.
Index ¶
Constants ¶
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 )
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 ¶
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".
type Void
deprecated
type Void = void
Void is a Logger implementation that throws away all log events.
Deprecated: use log.ToVoid() instead.