diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Core/Log/System.php | 25 | ||||
-rw-r--r-- | app/ServiceProvider/LoggingProvider.php | 4 | ||||
-rw-r--r-- | app/constants.php | 4 |
3 files changed, 31 insertions, 2 deletions
diff --git a/app/Core/Log/System.php b/app/Core/Log/System.php new file mode 100644 index 00000000..ce801a02 --- /dev/null +++ b/app/Core/Log/System.php @@ -0,0 +1,25 @@ +<?php + +namespace Kanboard\Core\Log; + +/** + * Built-in PHP Logger + * + * @package Kanboard\Core\Log + * @author Frédéric Guillot + */ +class System extends Base +{ + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string $message + * @param array $context + * @return null + */ + public function log($level, $message, array $context = []) + { + error_log('['.$level.'] '.$this->interpolate($message, $context)); + } +} diff --git a/app/ServiceProvider/LoggingProvider.php b/app/ServiceProvider/LoggingProvider.php index eba9d0c4..2ff6ba4f 100644 --- a/app/ServiceProvider/LoggingProvider.php +++ b/app/ServiceProvider/LoggingProvider.php @@ -10,6 +10,7 @@ use Kanboard\Core\Log\Stderr; use Kanboard\Core\Log\Stdout; use Kanboard\Core\Log\Syslog; use Kanboard\Core\Log\File; +use Kanboard\Core\Log\System; /** * Class LoggingProvider @@ -37,6 +38,9 @@ class LoggingProvider implements ServiceProviderInterface case 'file': $driver = new File(LOG_FILE); break; + case 'system': + $driver = new System(); + break; } if ($driver !== null) { diff --git a/app/constants.php b/app/constants.php index 35d651e8..c47f8e87 100644 --- a/app/constants.php +++ b/app/constants.php @@ -26,8 +26,8 @@ defined('PLUGIN_INSTALLER') or define('PLUGIN_INSTALLER', true); // Enable/disable debug defined('DEBUG') or define('DEBUG', strtolower(getenv('DEBUG')) === 'true'); -// Logging drivers: syslog, stdout, stderr or file -defined('LOG_DRIVER') or define('LOG_DRIVER', ''); +// Logging drivers: syslog, stdout, stderr, system or file +defined('LOG_DRIVER') or define('LOG_DRIVER', 'system'); // Logging file defined('LOG_FILE') or define('LOG_FILE', DATA_DIR.DIRECTORY_SEPARATOR.'debug.log'); |