<?php
//namespace Billdesk;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\FirePHPHandler;
use Monolog\Logger;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Processor\IntrospectionProcessor;



class OscBillDeskLogger {
    const DEFAULT_CHANNEL = 'default';

    static function logger($channel) {
        $logger = new Logger($channel);
        
        $level =Logger::DEBUG ;

        $fileStream = new RotatingFileHandler( dirname( __FILE__ ) . "/logs/osc_billdesk.log", $level);
        error_log("Inside Oscommerce Logger : " .dirname( __FILE__ ). PHP_EOL, 0);
        $dateFormat = "Y-m-d H:i:s e";
        $output = "%datetime% [%channel%.%level_name%] %message% - %context% %extra%\n";
        $formatter = new LineFormatter($output, $dateFormat);

        $fileStream->setFormatter($formatter);
        $logger->pushProcessor(new IntrospectionProcessor());
        $logger->pushHandler($fileStream);
        return $logger;
    }

    static function defaultLogger() {
        return OcBillDeskLogger::logger(OcBillDeskLogger::DEFAULT_CHANNEL);
    }
}