EventStore / EventStore-Client-Go

Go Client for Event Store version 20 and above.
Apache License 2.0
105 stars 27 forks source link

Implement Logging abstraction. #119

Closed YoEight closed 2 years ago

YoEight commented 2 years ago

Fixes #117

The designed solution is based upon the LoggingFunc callback.

type LoggingFunc = func(scope string, format string, args ...interface{})

By default, the library provides two implementations: esdb.ConsoleLogging() (enabled by default) and esdb.NoopLogging() (logs nothing).

Users can plug their own implementation by setting esdb.Configuration 's Logger property:

conf, err := esdb.ParseConnectionString("{connectionString}")
if err != nil {
    panic(err)
}

conf.Logger = myLoggingImpl()
db, err := esdb.NewClient(conf)
...