Implemented verbosity control by option -report_about

This commit is contained in:
Thomas Schmitt 2007-10-19 16:49:37 +00:00
parent f399a30e65
commit 4195d73f82
6 changed files with 54 additions and 13 deletions

View File

@ -1781,6 +1781,8 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
for(i=0; i<4; i++)
m->logfile[i][0]= 0;
m->status_history_max= Xorriso_status_history_maX;
strcpy(m->report_about_text, "ALL");
Xorriso__text_to_sev(m->report_about_text, &m->report_about_severity, 0);
m->library_msg_direct_print= 0;
strcpy(m->abort_on_text,"FATAL");
Xorriso__text_to_sev(m->abort_on_text, &m->abort_on_severity, 0);
@ -2821,6 +2823,11 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (strcmp(xorriso->report_about_text,"ALL")==0);
sprintf(line,"-report_about %s\n",xorriso->report_about_text);
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (strcmp(xorriso->abort_on_text,"FATAL")==0);
sprintf(line,"-abort_on %s\n",xorriso->abort_on_text);
if(!(is_default && no_defaults))
@ -3001,9 +3008,8 @@ int Xorriso_msgs_submit(struct XorrisO *xorriso,
}
/* Report problem event */
/* >>> need option with threshhold for message reporting */
if(sev<xorriso->report_about_severity && sev<xorriso->abort_on_severity)
return(2);
sprintf(prefix,"%s%s : ", pfx_list[(flag>>2)&15], sev_text);
li= strlen(prefix);
lt= strlen(msg_text);
@ -3756,6 +3762,9 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
"General options:",
" -help Print this text",
" -abort_on severity Set the threshhold for events to abort the program.",
" Useful severities are: NEVER, ABORT, FATAL, SORRY, WARNING",
" -report_about severity Set the threshhold for events to be reported.",
" Use -abort_on severities or: HINT, NOTE, UPDATE, DEBUG, ALL",
" -dialog after all arguments are processed, enter dialog mode.",
" In this mode you may enter searchtexts or any of the options",
" described here. One per line.",
@ -4215,6 +4224,30 @@ int Xorriso_option_pwdx(struct XorrisO *xorriso, int flag)
}
/* Option -reassure "on"|"off" */
int Xorriso_option_reassure(struct XorrisO *xorriso, char *mode, int flag)
{
xorriso->do_reassure= !!strcmp(mode, "off");
return(1);
}
/* Option -report_about */
int Xorriso_option_report_about(struct XorrisO *xorriso, char *severity,
int flag)
{
int ret, sev;
ret= Xorriso__text_to_sev(severity, &sev, 0);
if(ret<=0)
return(ret);
if(Sfile_str(xorriso->report_about_text,severity,0)<=0)
return(-1);
xorriso->report_about_severity= sev;
return(1);
}
/* Options -rm alias -rmi , and -rm_r aias -rm_ri */
/* @param flag bit0=recursive */
int Xorriso_option_rmi(struct XorrisO *xorriso, int argc, char **argv,
@ -4252,14 +4285,6 @@ int Xorriso_option_rmdiri(struct XorrisO *xorriso, int argc, char **argv,
}
/* Option -reassure "on"|"off" */
int Xorriso_option_reassure(struct XorrisO *xorriso, char *mode, int flag)
{
xorriso->do_reassure= !!strcmp(mode, "off");
return(1);
}
/* Option -rollback */
int Xorriso_option_rollback(struct XorrisO *xorriso, int flag)
{
@ -4702,6 +4727,10 @@ next_command:;
(*idx)++;
ret= Xorriso_option_reassure(xorriso, arg1, 0);
} else if(strcmp(cmd,"-report_about")==0) {
(*idx)++;
ret= Xorriso_option_report_about(xorriso, arg1, 0);
} else if(strcmp(cmd,"-rm")==0 || strcmp(cmd,"-rmi")==0) {
ret= Xorriso_option_rmi(xorriso, argc, argv, idx, 0);

View File

@ -276,6 +276,10 @@ int Xorriso_option_pwdi(struct XorrisO *xorriso, int flag);
/* Option -pwdx */
int Xorriso_option_pwdx(struct XorrisO *xorriso, int flag);
/* Option -report_about */
int Xorriso_option_report_about(struct XorrisO *xorriso, char *severity,
int flag);
/* Option -reassure "on"|"off" */
int Xorriso_option_reassure(struct XorrisO *xorriso, char *mode, int flag);

View File

@ -392,6 +392,12 @@ Exception processing:
the setting by this option. Expect not many "ABORT" events to
be ignorable.
-report_about severity Set the threshhold for events to be reported.
Events are the same as with -abort_on. Regardless what is
set by -report_about, messages get always reported if they
reach the severity threshhold of -abort_on .
> -overwrite "on"|"off" Allow or disallow to overwrite existing files in the
ISO image by a file with the same user defined name. This is
the RockRidge name and not the plain ISO name.

View File

@ -125,6 +125,8 @@ struct XorrisO { /* the global context of xorriso */
int status_history_max; /* for -status long_history */
/* >>> put -abort_on severity parameters here <<< */
char report_about_text[20];
int report_about_severity;
int library_msg_direct_print;
char abort_on_text[20];
int abort_on_severity; /* A severity rank number as threshold */

View File

@ -1 +1 @@
#define Xorriso_timestamP "2007.10.19.151339"
#define Xorriso_timestamP "2007.10.19.164957"

View File

@ -76,7 +76,7 @@ int Xorriso_startup_libraries(struct XorrisO *xorriso, int flag)
/* >>> need option for controlling this in XorrisO.
See also Xorriso_msgs_submit */;
print_sev= "DEBUG";
print_sev= xorriso->report_about_text;
} else
print_sev= "NEVER";
iso_msgs_set_severities(queue_sev, print_sev, "libisofs : ");