[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Proper loglevels: cmd-line option --loglevel=NONE/ERROR/WARN/PROGRES

From: Han-Wen Nienhuys
Subject: Re: Proper loglevels: cmd-line option --loglevel=NONE/ERROR/WARN/PROGRESS/INFO/DEBUG (issue4822055)
Date: Thu, 4 Aug 2011 00:41:30 -0300

On Sat, Jul 30, 2011 at 2:42 PM, Reinhold Kainhofer
<address@hidden> wrote:
> Am Samstag, 30. Juli 2011, 18:28:32 schrieben Sie:
>> overall commment: the parts that do the reporting should not need to
>> know about the format of loglevel.
> Which parts exactly do you mean? Those that call the error/message/warning
> functions, or the error/message/warning functions themselves?

What I mean is that the callers should tag their messages with the
type of the message, and let the logging framework decide whether to
print it or not.

There are some tiny performance optimizations, like

-  if (be_verbose_global)
+  if (loglevel & LOG_DEBUG)
       string spaces = "";
       for (size_t i = 0; i < state_stack_.size (); i++)
        spaces += " ";
-      progress_indication (string ("\n") + spaces + string ("[") +
file->name_string ());
+      debug_output (spaces + string ("[") + file->name_string ());

you could just drop the if in this case.

> You mean in those few places where I need to use "if (loglevel & LOG_DEBUG)",
> because I can't call the debug_output function? That's a good idea to keep the
> internal structure of the loglevel only inside and provide a helper
> function to access them.


> Yes, that function is currently called non_fatal_error... Unfortunately, in

Also, in lilypond, the difference between (non_fatal) error and
warning never has been very clear. Maybe we should just have a

  fatal("..") // exits


  error("..") // does not exit, but sets return status = 1

  warning("..") // prints, succesful exist status.

Han-Wen Nienhuys - address@hidden -

reply via email to

[Prev in Thread] Current Thread [Next in Thread]