function lingotek_error in Lingotek Translation 6
Same name and namespace in other branches
- 7.2 lingotek.util.inc \lingotek_error()
7 calls to lingotek_error()
File
- ./
lingotek.util.inc, line 134 - Utilities
Code
function lingotek_error($msg, $data = NULL, $depth = 0, $severity = WATCHDOG_ERROR) {
if ($severity == WATCHDOG_WARNING && variable_get('lingotek_warning_log', FALSE)) {
return;
}
$backtrace = debug_backtrace();
$location = $backtrace[$depth]['file'] . ':' . $backtrace[$depth]['line'];
$function = $backtrace[$depth + 1]['function'];
$args = @json_encode($backtrace[$depth + 1]['args']);
$data_output = "";
if (isset($data)) {
$data_output = json_encode($data);
}
watchdog('lingotek', '<span style="word-break: break-all;"><b>MESSAGE:</b> %msg <br /><b>DATA:</b> %data <br /><b>FILE:</b> %location<br /><b>FUNCTION:</b>%function<br /><b>ARGS:</b> %args</span>', array(
'%msg' => $msg,
'%data' => $data_output,
'%location' => $location,
'%function' => $function,
'%args' => $args,
), $severity);
if (variable_get('lingotek_error_log', FALSE)) {
error_log("MESSAGE: {$msg} DATA: {$data_output} FILE: {$location} FUNCTION: {$function} ARGS: {$args}");
}
}