File.Only.Logger (File-Only Logger v0.1.34) View Source
A simple logger which writes messages to log files only (not to the console).
Link to this section Summary
Functions
Either aliases File.Only.Logger
(this module) and requires the alias or
imports File.Only.Logger
. In the latter case, you could instead simply
import File.Only.Logger
.
Returns the application for the current process or module.
Injects function error
into the caller's module.
Returns a heredoc to trace the logged message back to its source using the given environment.
Returns string "<module>.<function>/<arity>" e.g. "My.Math.sqrt/1"
for the given environment. A string longer than limit
will be prefixed with "\n\s\s".
Injects function info
into the caller's module.
Returns the current library name.
Returns the current module name.
Link to this section Functions
Either aliases File.Only.Logger
(this module) and requires the alias or
imports File.Only.Logger
. In the latter case, you could instead simply
import File.Only.Logger
.
Examples
use File.Only.Logger, alias: FileLogger
use File.Only.Logger
import File.Only.Logger
Returns the application for the current process or module.
Returns :undefined
if the current process does not belong to any application or the current module is not listed in any application spec.
Examples
use File.Only.Logger
error :exit, {reason} do
"""
\n'exit' caught...
• Reason: #{inspect(reason)}
• App: #{app()}
"""
end
Injects function error
into the caller's module.
The function will write the message
returned by the do_block
to the configured error log file.
Examples
use File.Only.Logger
error :exit, {reason} do
"""
\n'exit' caught...
• Reason: #{inspect(reason)}
"""
end
Returns a heredoc to trace the logged message back to its source using the given environment.
Examples
use File.Only.Logger
error :exit, {reason, env} do
"""
\n'exit' caught...
• Reason:
#{inspect(reason)}
#{from(env)}
"""
end
Returns string "<module>.<function>/<arity>" e.g. "My.Math.sqrt/1"
for the given environment. A string longer than limit
will be prefixed with "\n\s\s".
Examples
use File.Only.Logger
error :exit, {reason, env} do
"""
\n'exit' caught...
• Reason: #{inspect(reason)}
• Function: #{fun(env)}
"""
end
Injects function info
into the caller's module.
The function will write the message
returned by the do_block
to the configured info log file.
Examples
use File.Only.Logger
info :game_state, {player, game} do
"""
\nNote that #{player.name}...
• Has joined game #{inspect(game.name)}
• Game state: #{inspect(game.state)}
"""
end
Returns the current library name.
Examples
use File.Only.Logger
error :exit, {reason} do
"""
\n'exit' caught...
• Reason: #{inspect(reason)}
• Library: #{lib()}
"""
end
Returns the current module name.
Examples
use File.Only.Logger
error :exit, {reason} do
"""
\n'exit' caught...
• Reason: #{inspect(reason)}
• Module: #{mod()}
"""
end