Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON as fallback encoding #375

Merged
merged 2 commits into from
Apr 28, 2023
Merged

Commits on Apr 26, 2023

  1. test: add more test cases for map, slice, struct

    Those are types for which the Sprintf("%+v") catchall code is used.
    pohly committed Apr 26, 2023
    Configuration menu
    Copy the full SHA
    6bb2990 View commit details
    Browse the repository at this point in the history

Commits on Apr 27, 2023

  1. formatting: replace Sprintf("%+v") with JSON

    The output of Sprintf("%+v") is neither readable nor parseable. JSON encoding
    is better in both regards.
    
    There are some downsides:
    - Unexported fields don't get encoded anymore. However, the same happens
      with other backends (in particular, zapr), so one could also
      argue that making the text format behave like those others
      is good because developers notice early that they custom
      String and MarshalLog methods if they want to log such fields.
    - The result KObjs (a slice) now gets encoded as array of structs.
      KObjs already got deprecated a year ago. KObjSlice should be used
      instead.
    pohly committed Apr 27, 2023
    Configuration menu
    Copy the full SHA
    d731661 View commit details
    Browse the repository at this point in the history