static function trigger_error($error_msg, $error_type = E_USER_NOTICE, $echo = false)
{
$is_development = static::is_development();
if (!static::doing_ajax() && !static::doing_xmlrpc() && !static::doing_cron()) {
if ($is_development) {
if ($echo) {
echo "{$error_msg} [{$error_type}] ";
} else {
trigger_error($error_msg, $error_type);
}
}
} else {
if ($is_development || static::do_log_errors()) {
/**
* ONLY triggers errors:
* IF runmode() == WPLib::DEVELOPMENT
* OR define( 'WPLIB_LOG_ERRORS', true ) in /wp-config.php.
*
* For runmode() == WPLib::DEVELOPMENT define( 'WPLIB_RUNMODE', 0 ) in /wp-config.php.
*/
error_log("{$error_msg} [{$error_type}]");
}
}
}