27 using namespace shogun;
33 "[NOTICE] \0",
"[WARN] \0",
"[ERROR] \0",
34 "[CRITICAL] \0",
"[ALERT] \0",
"[EMERGENCY] \0",
"\0"};
37 "[NOTICE] \0",
"\033[1;34m[WARN]\033[0m \0",
"\033[1;31m[ERROR]\033[0m \0",
38 "[CRITICAL] \0",
"[ALERT] \0",
"[EMERGENCY] \0",
"\0"};
47 : target(stdout), last_progress_time(0), progress_start_time(0),
48 last_progress(1), show_progress(false), show_file_and_line(false),
49 syntax_highlight(true), loglevel(
MSG_WARN), refcount(0)
54 : target(orig.get_target()), last_progress_time(0),
55 progress_start_time(0), last_progress(1),
56 show_progress(orig.get_show_progress()),
57 show_file_and_line(orig.get_show_file_and_line()),
58 syntax_highlight(orig.get_syntax_highlight()),
59 loglevel(orig.get_loglevel()), refcount(0)
64 int32_t line,
const char *fmt, ... )
const
71 snprintf(str,
sizeof(str),
"%s", msg_intro);
72 int len=strlen(msg_intro);
77 snprintf(s,
sizeof(str)-len,
"In file %s line %d: ", file, line);
84 vsnprintf(s,
sizeof(str)-len, fmt, list);
125 fprintf(
target,
"%s", msg_intro);
128 vfprintf(
target,fmt,list);
135 int32_t decimals,
const char* prefix)
143 float64_t v=-1, estimate=0, total_estimate=0 ;
145 if (max_val-min_val>0.0)
146 v=100*(current_val-min_val+1)/(max_val-min_val+1);
172 snprintf(str,
sizeof(str),
"%%s %%%d.%df%%%% %%1.1f minutes remaining %%1.1f minutes total \r",decimals+3, decimals);
177 snprintf(str,
sizeof(str),
"%%s %%%d.%df%%%% %%1.1f seconds remaining %%1.1f seconds total \r",decimals+3, decimals);
186 int32_t decimals,
const char* prefix)
194 float64_t v=-1, estimate=0, total_estimate=0 ;
196 if (max_val-min_val>0)
197 v=100*(val-min_val+1)/(max_val-min_val+1);
223 snprintf(str,
sizeof(str),
"%%s %%%d.%df %%1.1f minutes remaining %%1.1f minutes total \r",decimals+3, decimals);
228 snprintf(str,
sizeof(str),
"%%s %%%d.%df %%1.1f seconds remaining %%1.1f seconds total \r",decimals+3, decimals);
249 for (i=0; isspace(str[i]); i++);
263 for (i=0; isblank(str[i]); i++);