View Source MetaLogger.Slicer (MetaLogger v1.7.0)
Responsible for slicing log entries according to the given max length option.
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.
Types
@type max_entry_length() :: non_neg_integer() | :infinity
Max length in bytes or :infinity
if the entry should not be sliced.
Functions
@spec 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"]