The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: userfriendly on November 17, 2017, 05:18:09 PM

Title: 120.2.3 Nightly Linux pak192.comic.0.4.1 - debug level 5 disables debug messages
Post by: userfriendly on November 17, 2017, 05:18:09 PM
Not sure if this is a bug, but the help output of sim -h indicates the debug can be between 1 and 5 and setting it to 5 doesn't actually print debug messages.
Execution arguments are: -async -debug 5 -use_hw -screensize 1200x700 -lang en -objects pak192.comic.0.4.1 -nosound -nomidi -load save1.sve.
Debug messages, such as
dbg->debug("tool_t::read_menu()", "creating %s", id);
are not logged. Looking at log.cc:85:    if(log_debug  &&  debuglevel==4) {, it seems only debug level 4 will allow printing.

Sorry if this has been reported or is not really a bug. Maybe it's just the help text or I didn't read some documentation?
Title: Re: 120.2.3 Nightly Linux pak192.comic.0.4.1 - debug level 5 disables debug messages
Post by: Ters on November 17, 2017, 07:16:57 PM
The help text can perhaps be read that (1..5) is an open interval, meaning that 1 and 5 are themselves not included. I don't think that is intended, though. The code very much treats 1 as a valid log level. In fact, it even appears that 0 is a valid level.

Another oddity in the logging is that vmessage is not a variant of message, but of error, since it checks for debuglevel>0 not debuglevel>2
Title: Re: 120.2.3 Nightly Linux pak192.comic.0.4.1 - debug level 5 disables debug messages
Post by: userfriendly on November 17, 2017, 08:27:47 PM
The perhaps it's about consistency and clear help?
Title: Re: 120.2.3 Nightly Linux pak192.comic.0.4.1 - debug level 5 disables debug messages
Post by: prissi on March 20, 2018, 12:42:10 AM
In r8410 the debug levels are now defined as intended, i.e. >=level. Currently there are level 0 (nothing) 1 (error) 2(error+warning) 3(error+warnings+messages) and 4 (all messages).