View Source RingLogger.Client (ring_logger v0.11.3)
Interact with the RingLogger
Summary
Functions
Attach the current IEx session to the logger. It will start printing log messages.
Returns a specification to start this module under a supervisor.
Fetch the current client configuration.
Update the client configuration.
Count the next set of the messages in the log.
Detach the current IEx session from the logger.
Helper method for formatting log messages per the current client's configuration.
Run a regular expression on each entry in the log and print out the matchers.
Get the next set of the messages in the log.
Reset the index into the log for tail/1
to the oldest entry.
Format and save all log messages to the specified path.
Start up a client GenServer. Except for just getting the contents of the ring buffer, you'll
need to create one of these. See configure/2
for information on options.
Stop a client.
Get the last n messages.
Functions
@spec attach(GenServer.server()) :: :ok
Attach the current IEx session to the logger. It will start printing log messages.
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec config(pid()) :: RingLogger.client_options()
Fetch the current client configuration.
@spec configure(GenServer.server(), RingLogger.client_options()) :: :ok
Update the client configuration.
Options include:
:io
- Defaults to:stdio
:colors
-:metadata
- A KV list of additional metadata:format
- A custom format string, or a {module, function} tuple (see https://hexdocs.pm/logger/master/Logger.html#module-custom-formatting):level
- The minimum log level to report.:module_levels
- a map of log level overrides per module. For example, %{MyModule => :error, MyOtherModule => :none}:application_levels
- a map of log level overrides per application. For example, %{:my_app => :error, :my_other_app => :none}. Note log levels set in:module_levels
will take precedence.
@spec configure_module_levels(RingLogger.client_options()) :: map()
@spec count_next(GenServer.server()) :: non_neg_integer()
Count the next set of the messages in the log.
@spec detach(GenServer.server()) :: :ok
Detach the current IEx session from the logger.
@spec format(GenServer.server(), RingLogger.entry()) :: :ok
Helper method for formatting log messages per the current client's configuration.
@spec grep(GenServer.server(), String.t() | Regex.t(), RingLogger.client_options()) :: :ok | {:error, term()}
Run a regular expression on each entry in the log and print out the matchers.
Supported options:
:pager
- an optional 2-arity function that takes an IO device and what to print:before
- Number of lines before the match to include:after
- NUmber of lines after the match to include
@spec grep_metadata( GenServer.server(), atom(), String.t() | Regex.t(), RingLogger.client_options() ) :: :ok | {:error, term()}
@spec next(GenServer.server(), RingLogger.client_options()) :: :ok | {:error, term()}
Get the next set of the messages in the log.
Supported options:
:pager
- an optional 2-arity function that takes an IO device and what to print
@spec reset(GenServer.server()) :: :ok
Reset the index into the log for tail/1
to the oldest entry.
@spec save(GenServer.server(), Path.t()) :: :ok | {:error, term()}
Format and save all log messages to the specified path.
@spec start_link(RingLogger.client_options()) :: GenServer.on_start()
Start up a client GenServer. Except for just getting the contents of the ring buffer, you'll
need to create one of these. See configure/2
for information on options.
@spec stop(GenServer.server()) :: :ok
Stop a client.
@spec tail(GenServer.server(), non_neg_integer(), RingLogger.client_options()) :: :ok | {:error, term()}
Get the last n messages.
Supported options:
:pager
- an optional 2-arity function that takes an IO device and what to print