Commit 52e9cd5c authored by Taylor Otwell's avatar Taylor Otwell

Merge pull request #1639 from frankwong/master

Add calling class and function information in logs
parents b914d079 023e11e6
...@@ -56,7 +56,31 @@ class Log { ...@@ -56,7 +56,31 @@ class Log {
Event::fire('laravel.log', array($type, $message)); Event::fire('laravel.log', array($type, $message));
} }
$message = static::format($type, $message); $trace=debug_backtrace();
foreach($trace as $item)
{
if (isset($item['class']) AND $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); 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