MetaLogger.Slicer (meta_logger v1.4.1) View Source

Responsible for slicing log entries according to the given max length option.

Link to this section Summary

Types

Max length in bytes or :infinity if the entry should not be sliced.

Functions

Returns sliced log entries according to the given max entry length.

Link to this section Types

Specs

max_entry_length() :: non_neg_integer() | :infinity

Max length in bytes or :infinity if the entry should not be sliced.

Link to this section Functions

Link to this function

slice(entry, max_entry_length)

View Source

Specs

slice(String.t(), max_entry_length()) :: [String.t()]

Returns sliced log entries according to the given max entry length.

If the entry is smaller than given max length, or if :infinity is given as option, a list with one entry is returned. Otherwise a list with multiple entries is returned.

Examples

iex> MetaLogger.Slicer.slice("1234567890", 10)
["1234567890"]

iex> MetaLogger.Slicer.slice("1234567890", :infinity)
["1234567890"]

iex> MetaLogger.Slicer.slice("1234567890", 5)
["12345", "67890"]