Skip to content

evanphx/go-hclog-slog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

An adapter from hclog to log/slog

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages