Neodriver_core.LogLogging infrastructure (Logs sources, connection ids, value formatting and the NEO4J_LOG_LEVEL / NEO4J_LOG_SCOPES environment control).
Logging for the Neo4j driver, mirroring the Python driver's logging.
Logs go through the standard Logs infrastructure, with one source per area of the Python driver's loggers. Logging is off by default; enable it with the NEO4J_LOG_LEVEL / NEO4J_LOG_SCOPES environment variables (honoured automatically at the first log call) or programmatically with setup / disable.
Connection-level logging: transport, handshake, Bolt message exchange, connection lifecycle and state changes (Python's neo4j.io).
Auth-manager logging: token refreshes and provider failures (Python's neo4j.auth_management).
The connection id used for events that happen without a connection (rendered as #0000).
A fresh connection id (a global process counter, hex-rendered as #0001, #0002, ...). It is not a network identifier: Eio's portable API has no getsockname, so a driver-assigned counter is used instead of the Python driver's local port — this keeps logging working on systems without file descriptors (e.g. MirageOS).
val value : Neodriver_packstream.Packstream.value -> stringvalue v renders v with Packstream.to_string.
val value_masked :
string list ->
Neodriver_packstream.Packstream.value ->
stringvalue_masked keys v is like value but every map entry whose key is in keys (recursively) has its value replaced by "*******" — used so HELLO / LOGON log lines never leak credentials.
Log at debug level on src, in Logs' msgf style (lazy: the message is formatted only when src reports at this level, so an inactive log statement costs nothing). Format the message with m; to render the Python-style connection prefix, embed it in the format, e.g. Log.debug Log.io (fun m -> m "[#%04X] C: RUN %s" id query).
Log at info level on src. See debug.
Log at warning level on src. See debug.
Log at error level on src. See debug.
NEO4J_LOG_LEVEL: off|error|warn|info|debug (default off);NEO4J_LOG_SCOPES: comma-separated io,pool,session,notifications,auth (default all).The environment is read once from the process-start snapshot (OCaml Sys.getenv semantics): runtime changes are picked up only through an explicit setup call. When NEO4J_LOG_LEVEL is unset, the driver never touches the user's Logs configuration.
val all_scopes : scope listEvery scope (Io; Pool; Session; Notifications; Auth).
val level_of_string : string -> level optionlevel_of_string s parses off|error|warn|info|debug.
val scope_of_string : string -> scope optionscope_of_string s parses io|pool|session|notifications|auth.
parse_env ~level ~scopes interprets the raw environment values: an absent or garbage level is Off; absent scopes mean all; garbage scope names are ignored. Pure (no environment access) so it can be unit-tested.
setup ?level ?scopes () installs (or removes) the reporter and sets the per-src levels. Idempotent and re-callable. Defaults: level = Off, scopes = all_scopes (equivalent to disable).
Read NEO4J_LOG_LEVEL / NEO4J_LOG_SCOPES and apply them. When the level variable is unset this is a no-op.