function payment_debug in Payment 7
Log/show a debugging message.
Parameters
string $message: The unstranslated US English message to process.
string $file: The path to the file the message originates from.
integer $line: The number of the line within $file the message originates from.
Return value
NULL
1 call to payment_debug()
1 string reference to 'payment_debug'
- payment_form_global_configuration in ./
payment.ui.inc - Implements form build callback: global configuration form.
File
- ./
payment.module, line 1059 - Hook implementations and shared functions.
Code
function payment_debug($message, $file = '', $line = 0) {
if (variable_get('payment_debug', TRUE)) {
// Make sure we have file and line information.
if (!$file || !$line) {
// Get the backtrace as fast as possible.
if (version_compare(phpversion(), '5.3.6') == -1) {
$backtrace = debug_backtrace(FALSE);
}
elseif (version_compare(phpversion(), '5.4.0') > -1) {
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 0);
}
else {
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
}
// Distill the caller's file and line information from the backtrace.
$caller = _drupal_get_last_caller($backtrace);
if (!$file) {
$file = $caller['file'];
}
if (!$line) {
$line = $caller['line'];
}
}
// Process the actual message.
$link = l(t('Do not log or display Payment debugging messages'), 'admin/config/services/payment/global');
$string = 'Debug: %message on line !line in @file (!hide).';
$string_arguments = array(
'%message' => $message,
'!line' => $line,
'@file' => $file,
'!hide' => $link,
);
drupal_set_message(t($string, $string_arguments));
watchdog('Payment', $string, $string_arguments);
}
}