Commit 5abb778b authored by frankwong's avatar frankwong

Added class and function information to log messages based on where the log message was initiated.

parent 23d23dd0
......@@ -56,7 +56,31 @@ class Log {
Event::fire('laravel.log', array($type, $message));
}
$message = static::format($type, $message);
$trace=debug_backtrace();
foreach($trace as $item)
{
if ($item['class'] == __CLASS__)
{
continue;
}
$caller = $item;
break;
}
$function = $caller['function'];
if (isset($caller['class']))
{
$class = $caller['class'] . '::';
}
else
{
$class = '';
}
$message = static::format($type, $class . $function . ' - ' . $message);
File::append(path('storage').'logs/'.date('Y-m-d').'.log', $message);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment