This method found under directory Phalcon\Logger. It provides logging services for application. We can login to different backend using different adapters. It offers transaction logging, configuration options, different formats and filters.
Adapters
Adapters are used to store the logged messages. A list of supported adapters:
Adapters | Description |
---|---|
Phalcon\Logger\Adapter\File | Logs to a plain text file |
Phalcon\Logger\Adapter\Stream | Logs to a PHP Streams |
Phalcon\Logger\Adapter\Syslog | Logs to the system logger |
Phalcon\Logger\Adapter\FirePHP | Logs to the FirePHP |
Creating a Log
<?php
use Phalcon\Logger;
use Phalcon\Logger\Adapter\File as FileAdapter;
$logger = new FileAdapter('app/logs/test.log');
// These are the different log levels available:
$logger->critical(
'This is a critical message'
);
$logger->emergency(
'This is an emergency message'
);
$logger->debug(
'This is a debug message'
);
$logger->error(
'This is an error message'
);
$logger->info(
'This is an info message'
);
?>
Leave a Reply