2015-01-16 14:23:05 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace ServiceProvider;
|
|
|
|
|
2015-08-16 17:04:56 +02:00
|
|
|
use Psr\Log\LogLevel;
|
2015-01-16 14:23:05 +01:00
|
|
|
use Pimple\Container;
|
|
|
|
use Pimple\ServiceProviderInterface;
|
|
|
|
use SimpleLogger\Logger;
|
|
|
|
use SimpleLogger\Syslog;
|
|
|
|
use SimpleLogger\File;
|
|
|
|
|
|
|
|
class LoggingProvider implements ServiceProviderInterface
|
|
|
|
{
|
|
|
|
public function register(Container $container)
|
|
|
|
{
|
2015-08-16 17:04:56 +02:00
|
|
|
$syslog = new Syslog('kanboard');
|
|
|
|
$syslog->setLevel(LogLevel::ERROR);
|
|
|
|
|
2015-01-16 14:23:05 +01:00
|
|
|
$logger = new Logger;
|
2015-08-16 17:04:56 +02:00
|
|
|
$logger->setLogger($syslog);
|
2015-01-16 14:23:05 +01:00
|
|
|
|
|
|
|
if (DEBUG) {
|
2015-02-25 17:29:06 +01:00
|
|
|
$logger->setLogger(new File(DEBUG_FILE));
|
2015-01-16 14:23:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$container['logger'] = $logger;
|
|
|
|
}
|
|
|
|
}
|