Download the PHP package fyre/log without Composer
On this page you can find all versions of the php package fyre/log. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package log
FyreLog
FyreLog is a free, open-source logging library for PHP.
Table Of Contents
- Installation
- Methods
- Loggers
- File
- Logging
Installation
Using Composer
In PHP:
Methods
Clear
Clear instances and configs.
Get Config
Get a Logger config.
$key
is a string representing the Logger key.
Alternatively, if the $key
argument is omitted an array containing all configurations will be returned.
Get Key
Get the key for a Logger instance.
$logger
is a Logger.
Has Config
Check if a Logger config exists.
$key
is a string representing the Logger key, and will default toLog::DEFAULT
.
Is Loaded
Check if a Logger instance is loaded.
$key
is a string representing the Logger key, and will default toLog::DEFAULT
.
Load
Load a Logger.
$config
is an array containing configuration options.
Set Config
Set the Logger config.
$key
is a string representing the Logger key.$options
is an array containing configuration options.
Alternatively, a single array can be provided containing key/value of configuration options.
Unload
Unload a Logger.
$key
is a string representing the Logger key, and will default toLog::DEFAULT
.
Use
Load a shared Logger instance.
$key
is a string representing the Logger key, and will default toLog::DEFAULT
.
Loggers
You can load a specific logger by specifying the className
option of the $config
variable above.
Custom loggers can be created by extending \Fyre\Log\Logger
, ensuring all below methods are implemented.
Can Handle
Determine if a log level can be handled.
$level
is a number indicating the log level.
By default, this method will return true if the $level
is below or equal to the threshold
defined in the logger config, otherwise false.
Handle
Handle a message log.
$type
is a string representing the type of log.$message
is a string representing the log message.
File
The File logger can be loaded using custom configuration.
$key
is a string representing the logger key.$options
is an array containing configuration options.className
must be set to\Fyre\Log\Handlers\FileLogger
.dateFormat
is a string representing the date format, and will default to "Y-m-d H:i:s".threshold
is a number representing the log threshold, and will default to 0.suffix
is a string representing the filename suffix, and will default to null.path
is a string representing the directory path, and will default to "/var/log".extension
is a string representing the file extension, and will default to "log".maxSize
is a number representing the maximum file size before log rotation, and will default to 1048576.
Logging
Generally, logging is done by calling the static methods of the Log class.
This will call the canHandle
method of all defined logger configs, and if that returns true then the handle
method will also be called.
The default log levels are shown below (in order of severity).
$message
is a string representing the log message.$data
is an array containing data to insert into the message string.
There are default placeholders that can also be used in log messages:
- {post_vars} will be replaced with the
$_POST
data. - {get_vars} will be replaced with the
$_GET
data. - {server_vars} will be replaced with the
$_SERVER
data. - {session_vars} will be replaced with the
$_SESSION
data. - {backtrace} will be replaced with the backtrace.
See the MessageFormatter::formatMessage method for details about message formatting.
All versions of log with dependencies
fyre/container Version ^1.0
fyre/filesystem Version ^2.0
fyre/path Version ^2.0