summaryrefslogtreecommitdiff
path: root/app/ServiceProvider/LoggingProvider.php
blob: 93f55a9cfffa4f9d39cdd8e8663d941b136c528c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

namespace ServiceProvider;

use Pimple\Container;
use Pimple\ServiceProviderInterface;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogHandler;

class LoggingProvider implements ServiceProviderInterface
{
    public function register(Container $container)
    {
        $logger = new Logger('app');
        $logger->pushHandler(new StreamHandler(__DIR__.'/../../data/debug.log', Logger::DEBUG));
        $logger->pushHandler(new SyslogHandler('kanboard', LOG_USER, Logger::DEBUG));

        $container['logger'] = $logger;
    }
}