Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added support for logging to php://output #44

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+15 −11
Split
View
@@ -768,17 +768,21 @@ public static function log($message, $level = null, $file = '', $forceLog = fals
try {
if (!isset($loggers[$file])) {
- $logDir = self::getBaseDir('var') . DS . 'log';
- $logFile = $logDir . DS . $file;
-
- if (!is_dir($logDir)) {
- mkdir($logDir);
- chmod($logDir, 0777);
- }
-
- if (!file_exists($logFile)) {
- file_put_contents($logFile, '');
- chmod($logFile, 0777);
+ if (substr($file,0,6) == 'php://') {
+ $logFile = $file;
+ } else {
+ $logDir = self::getBaseDir('var') . DS . 'log';
+ $logFile = $logDir . DS . $file;
+
+ if (!is_dir($logDir)) {
+ mkdir($logDir);
+ chmod($logDir, 0777);
+ }
+
+ if (!file_exists($logFile)) {
+ file_put_contents($logFile, '');
+ chmod($logFile, 0777);
+ }
}
$format = '%timestamp% %priorityName% (%priority%): %message%' . PHP_EOL;