hlandau / slogkit

Support utilities for Golang's slog structured logging library
1 stars 0 forks source link

Support standard json, text handlers in slogsyslog package #1

Open katevi opened 4 months ago

katevi commented 4 months ago

Hi, thank you for your amazing slogsyslog package!

For now logger works on copied from std lib textHandler and jsonHandlers and uses custom HandlerOptions https://github.com/hlandau/slogkit/blob/master/slogwriter/doc.go

Is it possible to add another constructor https://github.com/hlandau/slogkit/blob/master/slogsyslog/slogsyslog.go#L27 with standard jsonHandler, textHandlers with syslogLogger passed as io.Writer?

hlandau commented 3 months ago

Hello. Wow, I was not expecting people to start using this yet, as it was mainly for consumption in my own future projects. Thanks.

Be aware I haven't locked down these APIs yet, but since you appear to be interested in using this, I will make sure to do so in the future.

I had to make changes to the standard text/JSON logger which I expect to maintain going forward, so using a different logger would be difficult.

It is worth noting there is very little code in the slogsyslog package, so you could easily just instantiate my syslog package yourself. That is probably the most flexible option for you. I might break that out into a separate repo even so people don't have to pull down all of my slog-specific code.