function flog_stack in File logger 6
Same name and namespace in other branches
- 7 flog.module \flog_stack()
Dump the php stack to a file using debug_backtrace().
Parameters
$label: An optional label to include with the output.
$filename: An optional filename to write to. If not provided uses the default.
Return value
TRUE: file write succeeded FALSE: file write failed
See also
print_r()
File
- ./
flog.module, line 101 - File logger. Dump a variable to a configurable file.
Code
function flog_stack($label = 'STACK', $filename = NULL) {
$trace = debug_backtrace();
$results = t('STACK DUMP') . "\n";
foreach ($trace as $trace_item) {
$from = ' - ' . t('from') . ' ';
$from .= $trace_item['line'] ? t('line') . ' ' . $trace_item['line'] . ' ' . t('in') . ' ' . $trace_item['file'] : t('php function');
$results .= $trace_item['function'] . $from . "\n";
}
return flog_it($results, $label, $filename);
}