Hubert

Logger

Hubert uses Monolog as logger.

Installation

At first you have to extend the configuration of composer:

{
    "require": {
        "falkm/hubert-logger": "1.*"
    }
}

Configuation

Afterwards you have to extend the configuration of Hubert or create a new config/logger.global.php file. In the following example we define for instance that log files will be stored in logs/ and that error reports should not show up in the frontend.

<?php
return array(
    "factories" => array(
        "logger" => array(hubert\extension\logger\factory::class, 'get')
    ),
    "config" => array(
        "display_errors" => false,
        "logger" => array(
            "path" => dirname(__dir__).'/logs/',
        )
    ),
);

Usage

 hubert()->logger->error("test-error");

This command creates a file with a datestamp for example logs/2016-01-31.log and writes the error report "test-error" into it. How to use log files in detail and what other logging possibilities there are you can read at github.com/Seldaek/monolog.