Skip to content

Commit

Permalink
Diagnostics: error_log replaced with file_put_contents
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Dec 27, 2013
1 parent 490695b commit 2673ce7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Nette/Diagnostics/Logger.php
Expand Up @@ -56,7 +56,8 @@ public function log($message, $priority = NULL)
$message = implode(' ', $message);
}
$message = preg_replace('#\s*\r?\n\s*#', ' ', trim($message));
$res = error_log($message . PHP_EOL, 3, $this->directory . '/' . strtolower($priority ?: self::INFO) . '.log');
$file = $this->directory . '/' . strtolower($priority ?: self::INFO) . '.log';
$res = (bool) file_put_contents($file, $message . PHP_EOL, FILE_APPEND | LOCK_EX);

if (($priority === self::ERROR || $priority === self::CRITICAL) && $this->email && $this->mailer
&& @filemtime($this->directory . '/email-sent') + $this->emailSnooze < time() // @ - file may not exist
Expand Down

0 comments on commit 2673ce7

Please sign in to comment.