View Source lager (lager v1.0.0)

Link to this section Summary

Functions

Backwards compatible with beams compiled with lager 2.x
Manually log a message into lager without using the parse transform.
Manually log a message into lager without using the parse transform.
Manually log a message into lager without using the parse transform.
Get lager metadata for current process
Set lager metadata for current process. Will badarg if you don't supply a list of {key, value} tuples keyed by atoms.
Pretty-prints records with known definitions as tagged maps
Pretty-prints records with known definitions as tagged maps

Link to this section Types

-type boolean_opt(Name) :: Name | {Name, boolean()}.
-type log_level() :: none | logger:level().
-type log_level_number() :: 0..7.
-type pr_opt() :: boolean_opt(compress).

Link to this section Functions

Link to this function

dispatch_log(Severity, MetadataList, Format, Args, TruncSize)

View Source
-spec dispatch_log(Severity, MetadataList, Format, Args, TruncSize) -> ok
                when
                    Severity :: log_level(),
                    MetadataList :: [{atom(), term()}],
                    Format :: string(),
                    Args :: list(),
                    TruncSize :: non_neg_integer().
Backwards compatible with beams compiled with lager 2.x
Link to this function

dispatch_log(Sink, Severity, MetadataList, Format, Args, TruncSize, Safety)

View Source
-spec dispatch_log(Sink, Severity, MetadataList, Format, Args, TruncSize, Safety) -> ok | Error
                when
                    Sink :: atom(),
                    Severity :: log_level(),
                    MetadataList :: [{atom(), term()}],
                    Format :: string(),
                    Args :: list(),
                    TruncSize :: non_neg_integer(),
                    Safety :: safe | unsafe,
                    Error :: {error, Reason},
                    Reason :: {bad_sink, Sink}.
Link to this function

dispatch_log(Severity, Module, Function, Line, Pid, MetadataList, Format, Args, TruncSize)

View Source
-spec dispatch_log(Severity, Module, Function, Line, Pid, MetadataList, Format, Args, TruncSize) -> ok
                when
                    Severity :: log_level(),
                    Module :: module(),
                    Function :: atom(),
                    Line :: pos_integer(),
                    Pid :: pid(),
                    MetadataList :: [{atom(), term()}],
                    Format :: string(),
                    Args :: list(),
                    TruncSize :: non_neg_integer().
Backwards compatible with beams compiled with lager 1.x
Link to this function

log(Level, Process, Message)

View Source
-spec log(Level, Process | MetadataList, Message) -> ok
       when
           Level :: log_level(),
           Process :: pid() | atom(),
           MetadataList :: [{atom(), term()}],
           Message :: string().
Manually log a message into lager without using the parse transform.
Link to this function

log(Level, Process, Message, Args)

View Source
-spec log(Level, Process | MetadataList, Message, Args) -> ok
       when
           Level :: log_level(),
           Process :: pid() | atom(),
           MetadataList :: [{atom(), term()}],
           Message :: string(),
           Args :: list().
Manually log a message into lager without using the parse transform.
Link to this function

log(Sink, Level, Pid, Message, Args)

View Source
-spec log(Sink, Level, Process | MetadataList, Message, Args) -> ok | Error
       when
           Sink :: atom(),
           Level :: log_level(),
           Process :: pid() | atom(),
           MetadataList :: [{atom(), term()}],
           Message :: string(),
           Args :: list(),
           Error :: {error, Reason},
           Reason :: {bad_sink, Sink}.
Manually log a message into lager without using the parse transform.
Link to this function

log_unsafe(Level, MetadataList, Message, Args)

View Source
-spec log_unsafe(Level, MetadataList, Message, Args) -> ok
              when
                  Level :: log_level(),
                  MetadataList :: [{atom(), term()}],
                  Message :: string(),
                  Args :: list().
-spec md() -> [{atom(), any()}].
Get lager metadata for current process
-spec md([{atom(), any()}, ...]) -> ok.
Set lager metadata for current process. Will badarg if you don't supply a list of {key, value} tuples keyed by atoms.
-spec pr(Value, Module) -> MaybePrettyValue
      when
          Value :: Record | [Record] | NonRecord,
          Record :: tuple(),
          NonRecord :: term(),
          Module :: module(),
          MaybePrettyValue :: PrettyRecord | [PrettyRecord] | MaybePrettyNonRecord,
          PrettyRecord :: {RecordName, PrettyRecordFields},
          RecordName :: atom(),
          PrettyRecordFields :: #{RecordFieldName => MaybePrettyValue},
          RecordFieldName :: atom(),
          MaybePrettyNonRecord :: term().
Pretty-prints records with known definitions as tagged maps
-spec pr(Value, Module, Opts) -> MaybePrettyValue
      when
          Value :: Record | [Record] | NonRecord,
          Record :: tuple(),
          NonRecord :: term(),
          Module :: module(),
          MaybePrettyValue :: PrettyRecord | [PrettyRecord] | MaybePrettyNonRecord,
          PrettyRecord :: {RecordName, PrettyRecordFields},
          RecordName :: atom(),
          PrettyRecordFields :: #{RecordFieldName => MaybePrettyValue},
          RecordFieldName :: atom(),
          MaybePrettyNonRecord :: term(),
          Opts :: [pr_opt()].
Pretty-prints records with known definitions as tagged maps
-spec start() -> ok | {error, {atom(), term()}}.