Skip to content

Commit f01cb51

Browse files
committed
Fixed function write log
1 parent 38e6343 commit f01cb51

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

hungng/HungNG_CI_Base_Module.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,12 @@ protected function log($name = '', $message = '', $context = array(), $inputLeve
344344
default:
345345
$keyLevel = Monolog\Logger::INFO;
346346
}
347-
$fileName = __DIR__ . '/../../storage/logs/Log-' . date('Y-m-d') . '.log';
347+
if (defined('APPPATH')) {
348+
$applicationPath = APPPATH . '/logs-data/';
349+
} else {
350+
$applicationPath = dirname(__DIR__) . '/logs-data/';
351+
}
352+
$fileName = $applicationPath . 'Log-' . date('Y-m-d') . '.log';
348353
$formatter = new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n", "Y-m-d H:i:s u");
349354
$stream = new Monolog\Handler\StreamHandler($fileName, $keyLevel, true, 0777);
350355
$stream->setFormatter($formatter);

0 commit comments

Comments
 (0)