summaryrefslogtreecommitdiff
path: root/app/ServiceProvider
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-07 14:40:49 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-07 14:40:49 -0400
commit6361131d3f03bdc6f5642bfda8e1f165239d593a (patch)
tree1bcd0e73715502d516f08494fd71270c072492a7 /app/ServiceProvider
parent300dabe6b4e9e648c1111363fad8154def7cfb5f (diff)
Improve logging
Diffstat (limited to 'app/ServiceProvider')
-rw-r--r--app/ServiceProvider/LoggingProvider.php29
1 files changed, 22 insertions, 7 deletions
diff --git a/app/ServiceProvider/LoggingProvider.php b/app/ServiceProvider/LoggingProvider.php
index 68c074f0..4d6adbe4 100644
--- a/app/ServiceProvider/LoggingProvider.php
+++ b/app/ServiceProvider/LoggingProvider.php
@@ -6,6 +6,8 @@ use Psr\Log\LogLevel;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use SimpleLogger\Logger;
+use SimpleLogger\Stderr;
+use SimpleLogger\Stdout;
use SimpleLogger\Syslog;
use SimpleLogger\File;
@@ -14,19 +16,32 @@ class LoggingProvider implements ServiceProviderInterface
public function register(Container $container)
{
$logger = new Logger;
+ $driver = null;
- if (ENABLE_SYSLOG) {
- $syslog = new Syslog('kanboard');
- $syslog->setLevel(LogLevel::ERROR);
- $logger->setLogger($syslog);
+ switch (LOG_DRIVER) {
+ case 'syslog':
+ $driver = new Syslog('kanboard');
+ break;
+ case 'stdout':
+ $driver = new Stdout();
+ break;
+ case 'stderr':
+ $driver = new Stderr();
+ break;
+ case 'file':
+ $driver = new File(LOG_FILE);
+ break;
}
- if (DEBUG) {
- $logger->setLogger(new File(DEBUG_FILE));
+ if ($driver !== null) {
+ if (! DEBUG) {
+ $driver->setLevel(LogLevel::INFO);
+ }
+
+ $logger->setLogger($driver);
}
$container['logger'] = $logger;
-
return $container;
}
}