/* Decide whether to emit a trace or warning message. msg_level is one of: -1: recoverable corrupt-data warning, may want to abort. 0: important advisory messages (always display to user). 1: first level of tracing detail. 2,3,...: successively more detailed tracing messages. An application might override this method if it wanted to abort on warnings or change the policy about which messages to display.  */
emit_message(j_common_ptr cinfo, int msg_level)
/* Decide whether to emit a trace or warning message. msg_level is one of: -1: recoverable corrupt-data warning, may want to abort. 0: important advisory messages (always display to user). 1: first level of tracing detail. 2,3,...: successively more detailed tracing messages. An application might override this method if it wanted to abort on warnings or change the policy about which messages to display.  */
emit_message(j_common_ptr cinfo, int msg_level)
{
    struct jpeg_error_mgr* err = cinfo->err;
    if (msg_level < 0) {
        if (err->num_warnings == 0 || err->trace_level >= 3)
            (*err->output_message) (cinfo);
        err->num_warnings++;
    }
    else {
        if (err->trace_level >= msg_level)
            (*err->output_message) (cinfo);
    }
}