Categorygithub.com/evanphx/go-hclog-slog
repository
0.0.0-20240717231540-be48fc4c4df5
Repository: https://github.com/evanphx/go-hclog-slog.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

go-hclog-slog

This is a go module that allows hclog to be used with slog, a structured logging module that is included in Go 1.21 standard library.

To create a slog logger from an existing hclog.Logger value:


var existing hclog.Logger

...

log := slog.New(hclogslog.Adapt(existing))

Limitations

Today, slog provides Time and PC values to the handlers. Currently these are ignored by the adapter because hclog doesn't provide a way for these to be overriden per-log message. If a future version of hclog adds the ability to process them per log, this adapter will be updated.