ring_logger v0.8.0 RingLogger.Client View Source
Interact with the RingLogger
Link to this section 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.
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.
Link to this section Functions
attach(client_pid)
View Source
attach(GenServer.server()) :: :ok
attach(GenServer.server()) :: :ok
Attach the current IEx session to the logger. It will start printing log messages.
child_spec(init_arg) View Source
Returns a specification to start this module under a supervisor.
See Supervisor.
config(client_pid)
View Source
config(pid()) :: [RingLogger.client_option()]
config(pid()) :: [RingLogger.client_option()]
Fetch the current client configuration.
configure(client_pid, config)
View Source
configure(GenServer.server(), [RingLogger.client_option()]) :: :ok
configure(GenServer.server(), [RingLogger.client_option()]) :: :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_levelswill take precedence.
configure_module_levels(config) View Source
detach(client_pid)
View Source
detach(GenServer.server()) :: :ok
detach(GenServer.server()) :: :ok
Detach the current IEx session from the logger.
format(client_pid, message)
View Source
format(GenServer.server(), RingLogger.entry()) :: :ok
format(GenServer.server(), RingLogger.entry()) :: :ok
Helper method for formatting log messages per the current client's configuration.
grep(client_pid, regex_or_string, opts \\ [])
View Source
grep(GenServer.server(), String.t() | Regex.t(), [RingLogger.client_option()]) ::
:ok | {:error, term()}
grep(GenServer.server(), String.t() | Regex.t(), [RingLogger.client_option()]) :: :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
next(client_pid, opts \\ [])
View Source
next(GenServer.server(), keyword()) :: :ok | {:error, term()}
next(GenServer.server(), keyword()) :: :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
reset(client_pid)
View Source
reset(GenServer.server()) :: :ok
reset(GenServer.server()) :: :ok
Reset the index into the log for tail/1 to the oldest entry.
save(client_pid, path)
View Source
save(GenServer.server(), Path.t()) :: :ok | {:error, term()}
save(GenServer.server(), Path.t()) :: :ok | {:error, term()}
Format and save all log messages to the specified path.
start_link(config \\ [])
View Source
start_link(keyword()) :: GenServer.on_start()
start_link(keyword()) :: 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.
stop(client_pid)
View Source
stop(GenServer.server()) :: :ok
stop(GenServer.server()) :: :ok
Stop a client.
tail(client_pid, n, opts \\ []) View Source
Get the last n messages.
Supported options:
:pager- an optional 2-arity function that takes an IO device and what to print