summaryrefslogtreecommitdiff
path: root/app/ServiceProvider/LoggingProvider.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/ServiceProvider/LoggingProvider.php')
-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;
}
}