Skip to content

Commit f4ca7a3

Browse files
committed
Document Bolt logging utility
1 parent fd7645c commit f4ca7a3

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ defer driver.Close()
245245

246246
### Custom Logger
247247

248-
The `Log` field of the `neo4j.Config` struct is defined to be of interface `neo4j/log.Logger` which has the following definition.
248+
The `Log` field of the `neo4j.Config` struct is defined to be of interface `neo4j/log.Logger` which has the following definition:
249249

250250
```go
251251
type Logger interface {
@@ -257,3 +257,34 @@ type Logger interface {
257257
```
258258

259259
For a customised logging target, you can implement the above interface and pass an instance of that implementation to the `Log` field.
260+
261+
## Bolt tracing
262+
263+
Logging Bolt messages is done at the session level and is configured independently of the logging configuration described above.
264+
This is **disabled** by default.
265+
266+
### Console Bolt logger
267+
268+
For simplicity, we provide a predefined console logger which can be constructed by `neo4j.ConsoleBoltLogger`.
269+
270+
```go
271+
session := driver.NewSession(neo4j.SessionConfig{
272+
BoltLogger: &neo4j.ConsoleBoltLogger{},
273+
})
274+
defer session.Close()
275+
// [...]
276+
```
277+
278+
### Custom Bolt Logger
279+
280+
The `BoltLogger` field of the `neo4j.SessionConfig` struct is defined to be of interface `neo4j/log.BoltLogger` which has the following definition:
281+
282+
```go
283+
type BoltLogger interface {
284+
LogClientMessage(context string, msg string, args ...interface{})
285+
LogServerMessage(context string, msg string, args ...interface{})
286+
}
287+
```
288+
289+
For a customised logging target, you can implement the above interface and pass an instance of that implementation to the `BoltLogger` field.
290+

0 commit comments

Comments
 (0)