View Source LoggerJSON.JasonSafeFormatter (logger_json v5.1.3)

Utilities for converting metadata into data structures that can be safely passed to Jason.encode!/1.

Summary

Functions

Produces metadata that is "safe" for calling Jason.encode!/1 on without errors. This means that unexpected Logger metadata won't cause logging crashes.

Functions

@spec format(any()) :: any()

Produces metadata that is "safe" for calling Jason.encode!/1 on without errors. This means that unexpected Logger metadata won't cause logging crashes.

Current formatting is...

  • Maps: as is
  • Printable binaries: as is
  • Numbers: as is
  • Structs that don't implement Jason.Encoder: converted to maps
  • Tuples: converted to lists
  • Keyword lists: converted to Maps
  • everything else: inspected
Link to this function

jason_implemented?(data)

View Source