Copyright © 2014-2016 Takeru Ohta <phjgt308@gmail.com>
The location where log message issued
> Location = logi_location:new(lists, filter, 10).
> logi_location:to_map(Location).
#{application => stdlib,
function => filter,
line => 10,
module => lists,
process => <0.91.0>}
guess_location/0
returns the current location.
> Location = logi_location:guess_location(). % If logi_transform
is not used, a warning will be emitted.
=WARNING REPORT==== 19-Oct-2015::14:02:26 ===
pid: <0.91.0>
module: erl_eval
function: do_apply
line: 673
msg: "A deprecated function 'logi_location:guess_location/0' is called. Please use the {parse_transform, logi_transform}
compiler option."
> logi_location:to_map(Location).
#{application => stdlib,
function => do_apply,
line => 673,
module => erl_eval,
process => <0.91.0>}
application() = atom()
An application name
line() = pos_integer() | 0
A line number
0
means "Unknown Line"
abstract datatype: location()
A log message issued location
map_form() = #{process => pid(), application => application(), module => module(), function => atom(), line => line()}
The map representation of a location
from_map/1 | Creates a new location from Map |
get_application/1 | Gets the application of Location |
get_function/1 | Gets the function of Location |
get_line/1 | Gets the line of Location |
get_module/1 | Gets the module of Location |
get_process/1 | Gets the PID of Location |
guess_application/1 | Guesses the application to which Module belongs. |
guess_location/0 | (Deprecated.) Guesses the location where the function is called (parse transformation fallback). |
is_location/1 | Returns true if X is a location object, false otherwise. |
new/3 | Equivalent to new(self(), guess_application(Module), Module, Function, Line). |
new/5 | Creates a new location object. |
to_map/1 | Converts Location into a map form. |
unsafe_new/5 | Equivalent to new/5 except omission of the arguments validation. |
from_map(Map::map_form()) -> location()
Creates a new location from Map
self()
- application: guess_application(maps:get(module, Map))
- module: undefined
- function: undefined
- line: 0
get_application(Location::location()) -> atom()
Gets the application of Location
get_function(Location::location()) -> atom()
Gets the function of Location
get_line(Location::location()) -> line()
Gets the line of Location
get_module(Location::location()) -> module()
Gets the module of Location
get_process(Location::location()) -> pid()
Gets the PID of Location
guess_application(Module::module()) -> atom() | undefined
Guesses the application to which Module
belongs
guess_location() -> location()
This function is deprecated: Please use the {parse_transform, logi_transform}
compiler option
which replaces the function call to a more efficient code.
Guesses the location where the function is called (parse transformation fallback)
This function is too slow and provided for debugging/testing purposes only.is_location(X::location() | term()) -> boolean()
Returns true
if X
is a location object, false
otherwise.
new(Module::module(), Function::atom(), Line::line()) -> location()
Equivalent to new(self(), guess_application(Module), Module, Function, Line).
new(Pid::pid(), Application::application(), Module::module(), Function::atom(), Line::line()) -> location()
Creates a new location object
to_map(Location::location()) -> map_form()
Converts Location
into a map form
unsafe_new(Pid::pid(), Application::application(), Module::module(), Function::atom(), Line::line()) -> location()
Equivalent to new/5
except omission of the arguments validation
Generated by EDoc