/**
 * Write extended debug messsages into logfiles
 * when debug mode is enabled
 * 
 * @param string $error
 */
function wpstg_debug_log($error)
{
    global $wpstg_options;
    if (isset($wpstg_options['debug_mode'])) {
        wpstg_log($error);
    }
}
/**
 * Write unexpected errors into the log file
 */
function wpstg_error_processing()
{
    $msg = sanitize_text_field($_POST['wpstg_error_msg']);
    if (!empty($msg)) {
        wpstg_log($msg);
    }
    wp_die();
}