1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Cleaning up log files

This commit is contained in:
Hillel Coren 2016-03-22 17:14:40 +02:00
parent 5c1e9900d3
commit b0a4a9b31c
5 changed files with 14 additions and 5 deletions

View File

@ -642,6 +642,6 @@ class PaymentController extends BaseController
$message .= $error ?: trans('texts.payment_error');
Session::flash('error', $message);
Utils::logError("Payment Error [{$type}]: " . ($exception ? Utils::getErrorString($exception) : $message));
Utils::logError("Payment Error [{$type}]: " . ($exception ? Utils::getErrorString($exception) : $message), 'PHP', true);
}
}

View File

@ -708,4 +708,4 @@ if (Utils::isNinjaDev())
//ini_set('memory_limit','1024M');
//Auth::loginUsingId(1);
}
*/
*/

View File

@ -247,7 +247,7 @@ class Utils
return "***{$class}*** [{$code}] : {$exception->getFile()} [Line {$exception->getLine()}] => {$exception->getMessage()}";
}
public static function logError($error, $context = 'PHP')
public static function logError($error, $context = 'PHP', $info = false)
{
if ($error instanceof Exception) {
$error = self::getErrorString($error);
@ -271,7 +271,11 @@ class Utils
'count' => Session::get('error_count', 0),
];
Log::error($error."\n", $data);
if ($info) {
Log::info($error."\n", $data);
} else {
Log::error($error."\n", $data);
}
/*
Mail::queue('emails.error', ['message'=>$error.' '.json_encode($data)], function($message)

View File

@ -81,7 +81,7 @@ class Mailer
$emailError = $exception->getMessage();
}
Utils::logError("Email Error: $emailError");
//Utils::logError("Email Error: $emailError");
if (isset($data['invitation'])) {
$invitation = $data['invitation'];

View File

@ -58,4 +58,9 @@ if (strstr($_SERVER['HTTP_USER_AGENT'], 'PhantomJS') && Utils::isNinjaDev()) {
}
*/
// Write info messages to a separate file
$app->configureMonologUsing(function($monolog) {
$monolog->pushHandler(new Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-info.log', Monolog\Logger::INFO, false));
});
return $app;