You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to be able configure indentation when using the slog.JSONHandler in development. I'm aware that I can implement my own handler which support whatever formatting I like, but it would nice if this was built-in.
Proposal:
Add a JSONHandler.SetIndent method which mirrors the json.Encoder.SetIndent method.
package slog
// SetIndent instructs the handler to format the json output.// Calling SetIndent("", "") disables indentation.func (h*JSONHandler) SetIndent(prefix, indentstring)
Considerations:
I took at look the JSONHandler implementation and it appears to implement its own json encoder rather than using encoding/json. I assume this is for performance reasons. In light of this, adding indentation support probably isn't worth it. But I'll leave this here anyway.
The text was updated successfully, but these errors were encountered:
Proposal Details
I'd like to be able configure indentation when using the
slog.JSONHandler
in development. I'm aware that I can implement my own handler which support whatever formatting I like, but it would nice if this was built-in.Proposal:
Add a
JSONHandler.SetIndent
method which mirrors thejson.Encoder.SetIndent
method.Considerations:
I took at look the
JSONHandler
implementation and it appears to implement its own json encoder rather than usingencoding/json
. I assume this is for performance reasons. In light of this, adding indentation support probably isn't worth it. But I'll leave this here anyway.The text was updated successfully, but these errors were encountered: