Phalcon Logging

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:

AdaptersDescription
Phalcon\Logger\Adapter\FileLogs to a plain text file
Phalcon\Logger\Adapter\StreamLogs to a PHP Streams
Phalcon\Logger\Adapter\SyslogLogs to the system logger
Phalcon\Logger\Adapter\FirePHPLogs 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'  

);  

  

?> 

    Comments

    Leave a Reply

    Your email address will not be published. Required fields are marked *