PHP Класс lithium\analysis\logger\adapter\File

{{{ lithium\analysis\Logger::config(array( 'debug' => array('adapter' => 'File') )); lithium\analysis\Logger::write('debug', 'Something happened!'); }}} This will cause the message and the timestamp of the log event to be written to app/resources/tmp/logs/debug.log.
Наследование: extends lithium\core\Object
Показать файл Открыть проект

Открытые методы

Метод Описание
__construct ( array $config = [] ) : void Constructor.
write ( string $priority, string $message ) : Closure Appends a message to a log file.

Описание методов

__construct() публичный Метод

Constructor.
См. также: lithium\util\String::insert()
public __construct ( array $config = [] ) : void
$config array Settings used to configure the adapter. Available options: - `'path'` _string_: The directory to write log files to. Defaults to `/resources/tmp/logs`. - `'timestamp'` _string_: The `date()`-compatible timestamp format. Defaults to `'Y-m-d H:i:s'`. - `'file'` _\Closure_: A closure which accepts two parameters: an array containing the current log message details, and an array containing the `File` adapter's current configuration. It must then return a file name to write the log message to. The default will produce a log file name corresponding to the priority of the log message, i.e. `"debug.log"` or `"alert.log"`. - `'format'` _string_: A `String::insert()`-compatible string that specifies how the log message should be formatted. The default format is `"{:timestamp} {:message}\n"`.
Результат void

write() публичный Метод

Appends a message to a log file.
См. также: lithium\analysis\Logger::$_priorities
public write ( string $priority, string $message ) : Closure
$priority string The message priority. See `Logger::$_priorities`.
$message string The message to write to the log.
Результат Closure Function returning boolean `true` on successful write, `false` otherwise.