On Monday, July 11, 2011 14:15:17 Jie Zhang wrote: > On Wed, Jul 6, 2011 at 5:48 PM, Mike Frysinger wrote: > > if we tweak the name and merge your older idea, we could have: > > urj_log_error_describe (level) > > now that the message prefix issue is sorted out in the core, we dont need > > to worry about that anymore. > > As I said before, there is no meaning to pass levels other than > WARNING or ERROR to urj_log_error_describe. That function describes an > error.
urj_error_io() is akin to the C library strerror() and errno. so while they
usually describe warnings/errors, the fact that they're set/read is not
always. think of code which uses C library functions where you look for
multiple files ... some not being found is not an error or warning, but common
behavior. or perhaps reading from some data source was interrupted
(signal/ptrace/etc...). the errno would be EINTR, but would not be shown as
an error (if at all). or the data source is set as nonblocking and so you get
back EAGAIN since there is currently no data available.
if the user had a noisier debug level set, they might want to see all of those
hits, but they wouldnt get logged at the warning/error level. they'd get
logged at "detail" or perhaps "debug".
> > also, in the comment above the func, note that it implicitly calls
> > urj_error_reset().
> >
> >> + if (level == URJ_LOG_LEVEL_WARNING || level == URJ_LOG_LEVEL_ERROR)
> >> + {
> >> + r += log_printf (p, "%s: ", urj_log_level_string (level));
> >> + if (urj_log_state.level <= URJ_LOG_LEVEL_DETAIL)
> >> + r += log_printf (p, "%s:%i %s(): ", file, line, func);
> >> + }
> >
> > i think this part should read:
> > if (level == URJ_LOG_LEVEL_WARNING || level == URJ_LOG_LEVEL_ERROR ||
> > urj_log_state.level <= URJ_LOG_LEVEL_DEBUG)
> > r += log_printf (p, "%s: ", urj_log_level_string (level));
> > if (urj_log_state.level <= URJ_LOG_LEVEL_DETAIL)
> > r += log_printf (p, "%s:%i %s(): ", file, line, func);
>
> Yes, that's your idea in your previous email. I tried that. But I
> found always adding a level prefix would make output ugly and unclear
> to read. There is little use to indicate the level of a message when
> they are not errors or warnings. For the same reason, I chose to only
> output source line information for WARNING and ERROR.
i dont understand ... the prefix isnt normally seen, only when the user
manually increases the debug level. and when you increase the debug level,
you want the extra output. this snippet i actually tested and the output from
doing like "cable probe; detect" was unchanged at the default debug level of
"normal". only when i did "debug detail" did i see the extra prefixes.
-mike
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________ UrJTAG-development mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/urjtag-development
