Skip to content

options.Logger is incompatible to slog logger #898

@TLINDEN

Description

@TLINDEN

I am using the slog logger and wanted to enable the new Options.Logger feature, which fails:

lg := slog.Default()
opts.Logger = *lg
db, err := bolt.Open(db.Dbfile, 0600, opts)

Compilation fails:

cannot use *lg (variable of type slog.Logger) as bbolt.Logger value in assignment: slog.Logger does not implement bbolt.Logger (method Debug has pointer receiver)

So, in order to be able to use my existing logger setup, I'd have to implement a bolt.Logger wrapper around the slog logger.

I'd appreciate it, if slog would be supported directly.

best,
Tom

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions