Each time you run Fusion, it retrieves all current settings from the inner config
array, a monolithic data consisting of sequential and associative entries. This
page explains the schema of the log
part of these entries.
On This Page
Stream
The stream
entry configures the log output within the standard stream.
Threshold
The threshold
entry contains the upper limit for categorizing events as
loggable or non-loggable. By default, events at or below the INFO
level are
considered loggable.
$config["log"]["serializers"]["stream"]["threshold"] = \Valvoid\Fusion\Log\Events\Level::INFO;
Regardless of the set value, each event is evaluated against all possible levels in a fixed top-down sequence:
\Valvoid\Fusion\Log\Events\Level::DEBUG
\Valvoid\Fusion\Log\Events\Level::VERBOSE
\Valvoid\Fusion\Log\Events\Level::INFO
\Valvoid\Fusion\Log\Events\Level::NOTICE
\Valvoid\Fusion\Log\Events\Level::WARNING
\Valvoid\Fusion\Log\Events\Level::ERROR
For example, with the default value set to INFO
, events at the INFO
,
NOTICE
, WARNING
, and ERROR
levels will be logged.
Serializer
The serializer
entry contains the fully qualified class name that handles
the serialization of log events.
$config["log"]["serializers"]["stream"]["serializer"] = \Valvoid\Fusion\Log\Serializers\Streams\Terminal\Terminal::class;
In addition to the default terminal serializer, you can specify other serializers, such as:
- The pre-built
\Valvoid\Fusion\Log\Serializers\Streams\JSON\JSON::class
. - Any custom serializer implementation.
File
The file
entry configures the log output within cached files. These files
are stored in the nested log
directory inside the
cache directory.
Threshold
The threshold
entry contains the upper limit for categorizing events as
loggable or non-loggable. By default, events at or below the WARNING
level are
considered loggable.
$config["log"]["serializers"]["file"]["threshold"] = \Valvoid\Fusion\Log\Events\Level::WARNING;
Regardless of the set value, each event is evaluated against all possible levels in a fixed top-down sequence:
\Valvoid\Fusion\Log\Events\Level::DEBUG
\Valvoid\Fusion\Log\Events\Level::VERBOSE
\Valvoid\Fusion\Log\Events\Level::INFO
\Valvoid\Fusion\Log\Events\Level::NOTICE
\Valvoid\Fusion\Log\Events\Level::WARNING
\Valvoid\Fusion\Log\Events\Level::ERROR
For example, with the default value set to WARNING
, events at the
WARNING
and ERROR
levels will be logged.
Filename
The filename
entry contains a date format for naming the file that stores
the cached events. By default, Fusion groups the events by day, using a
format like "2024.05.02".
$config["log"]["serializers"]["file"]["filename"] = "Y.m.d";
In addition to the default value, the value can also be one of the following:
Y.m
, such as "2024.12".Y.m.d_H:i
, such as "2024.12.01_20:01".Y.m.d_H
, such as "2024.04.09_07".Y
, such as "2024".
The format constants are taken from the standard date
function, where the Y
stands for a
four-digit year, the m
for a two-digit month, the d
for a two-digit day, the
H
for a two-digit hour of the 24-hour loop, and the i
for a two-digit minute.
For more, see the official PHP documentation.
Serializer
The serializer
entry contains the fully qualified class name that handles
the serialization of log events.
$config["log"]["serializers"]["file"]["serializer"] = \Valvoid\Fusion\Log\Serializers\Files\Text\Text::class;
In addition to the default text serializer, you can specify other serializers, such as:
- The pre-built
\Valvoid\Fusion\Log\Serializers\Files\JSON\JSON::class
. - Any custom serializer implementation.