Logger.Backend.Humio.Formatter (logger_humio_backend v0.0.1) View Source

Extends the standard Logger.Formatter with support for additional pattersn:

  • $datetime, which will format the time stamp according to ISO8601.
  • $hostname
  • $pid, which takes the pid from the standard metadata as a stand-alone field. Will work even if :pid is not specified in the metadata config. To do so, it expects the metadata keyword list to contain the key iso8601_format_fun whose value is a function that accepts the below time type as parameter and returns a String type.
  • $application, which derives the application that submitted the log from the PID.

Link to this section Summary

Functions

Formats date as chardata.

Formats time as chardata.

Prunes invalid Unicode code points from lists and invalid UTF-8 bytes. Typically called after formatting when the data cannot be printed.

Link to this section Types

Specs

pattern() ::
  :date
  | :level
  | :levelpad
  | :message
  | :metadata
  | :node
  | :time
  | :datetime
  | :hostname
  | :pid
  | :application

Specs

time() :: {{1970..10000, 1..12, 1..31}, {0..23, 0..59, 0..59, 0..999}}

Link to this section Functions

Specs

compile(binary() | nil) :: [pattern() | binary()]
compile(pattern) :: pattern when pattern: {module(), function :: atom()}
Link to this function

format(config, level, msg, timestamp, metadata, metadata_keys)

View Source

Specs

format_date({1970..10000, 1..12, 1..31}) :: IO.chardata()

Formats date as chardata.

Specs

format_time({0..23, 0..59, 0..59, 0..999}) :: IO.chardata()

Formats time as chardata.

Specs

prune(IO.chardata()) :: IO.chardata()

Prunes invalid Unicode code points from lists and invalid UTF-8 bytes. Typically called after formatting when the data cannot be printed.

Link to this function

take_metadata(metadata, keys)

View Source