lp__error_log( $message, $trace = false, $echo = false )
The lp__error_log function is designed to log error messages in a flexible way, allowing you to control whether to include call traces in the error log and whether to display the log on the page.
Plugin
Namespace
Launchpad
Parameters
string
$message
Message to log
bool
$trace
Add traces to the error for easy tracing.
bool
$echo
Display the log on the page instead if enabled.
string
$prefix
Prefix to be added to the log message.
Return
void
Source
File: \includes\lp-utility-functions.php
function lp__error_log( $message, $trace = false, $echo = false ) {
$prefix = strtoupper( LP__PREFIX );
if( ! is_string( $message ) ){
$message = print_r( $message, true );
}
$message = "[$prefix] {$message}";
if( ( defined( 'WP_DEBUG' ) ? WP_DEBUG : false ) && $echo && current_user_can( 'administrator' ) ){
if( $trace ) {
$traces = lp__calltrace();
array_pop( $traces ); // remove call to this method
$message .= "<br/>" . implode("<br/>", $traces);
}
echo $message;
} else {
if( $trace ) {
$traces = lp__calltrace();
array_pop( $traces ); // remove call to this method
$message .= "\n\t" . implode("\n\t", $traces);
}
error_log( $message );
}
}