slog.SetDefault(slog.New(myHandler{Handler:slog.Default().Handler}))

vl...@mailbox.org a következőt írta (2023. augusztus 28., hétfő, 15:06:37 
UTC+2):

> Hi,
>
> When reading trough the log/slog documentation, it seems one can create 
> a logger with a different handler, which is either NewTextHandler or 
> NewJSONHandler.
>
> Why can't I configure the defaultHandler? Let's say I want my logger to 
> behave exactly like the defaultHandler, but output to a logfile or 
> Stdout instead.
>
> The defaultHandler's output is different compared to the NewTextHandler:
>
> slog.Info("ok"), gives me:
>
> INFO ok
>
> The NextTextHandler gives me:
>
> level=INFO msg="ok"
>
>
> Regards,
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/09cba7f7-6109-4874-9ab3-1584771499cdn%40googlegroups.com.

Reply via email to