logi_ex v0.1.1 Logi.Layout behaviour
Log Message Layout Behaviour.
This module defines the standard interface to format log messages issued by the functions in Logi module.
(e.g., Logi.info/3, Logi.warning/3, etc)
A layout instance may be installed into a channel along with an associated sink.
Examples
iex> format_fun = fn (_, format, data) -> :lists.flatten(:io_lib.format("EXAMPLE: " <> format <> "\n", data)) end
iex> layout = Logi.BuiltIn.Layout.Fun.new format_fun
iex> {:ok, _} = Logi.Channel.install_sink(Logi.BuiltIn.Sink.IoDevice.new(:foo, [layout: layout]), :info)
iex> Logi.info "hello world"
#OUTPUT# EXAMPLE: hello world
Summary
Types
A module that implements the Logi.Layout behaviour
A data which is subject to format
The value of the fourth arguemnt of the format/4 callback function
Formatted Data
An instance of Logi.Layout behaviour implementation module
Functions
Returns an formatted_data() which represents data formatted by layout in accordance with format and context
Gets the extra data of layout
Gets the module of layout
Returns true if x is a layout/0, false otherwise
Creates a new layout instance
Callbacks
Message formatting function
Types
A module that implements the Logi.Layout behaviour.
A data which is subject to format.
This type is an alias of the type of second arguemnt of the :io_lib.format/2.
The value of the fourth arguemnt of the format/4 callback function.
If the layout() does not have an explicit extra_data(), nil will be passed instead.
An instance of Logi.Layout behaviour implementation module.
Functions
format(Logi.Context.context, :io.format, data, layout) :: formatted_data
Returns an formatted_data() which represents data formatted by layout in accordance with format and context.
Gets the extra data of layout.
Gets the module of layout.
Returns true if x is a layout/0, false otherwise.
Creates a new layout instance.
Callbacks
format(Logi.Context.context, :io.format, data, extra_data) :: formatted_data
Message formatting function.