Board index FlightGear Development


FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.


Postby Philosopher » Fri Mar 07, 2014 11:00 pm

I'm working a bit on reworking the logging exposed to Nasal, since it hasn't been updated in years (besides the addition of the never-used logprint() by James, the old printlog() only goes to the $FG_HOME/fgfs.log file if it would also go to the console and is implemented in globals.nas - aka can't be depended on in $FG_ROOT/Nasal/*.nas). This is going to eventually help with the Nasal REPL (aka to capture output), but I discovered something really weird: sglog().would_log() returns true for any priority >= INFO! This almost seems like a bug to me, but OTOH it is required by the SG_LOG() macro to ensure that the logging file is not ignored in the if statement (since SG_LOG() uses would_log()).

First of all, I don't see the reason for it; I think it would be better to remove the would_log() from SG_LOG() and make the former return if it will actually get printed to the console. Second of all, it makes me have to check the priority manually, and it would be nice to just have the would_log() API for that. Third, I'm not sure if we're hard-coding the minimum log level for $FG_HOME/fgfs.log? IMO that would not be good, although it is an acceptable default if we were to choose anything. The problem is that it's pretty complicated code, and I don't want to have to chase any more sources right now. Any comments from others? I don't want to go running around and changing this without input :D.

See this comment: ... s.cxx#L463
And this particular line of would_log(): ... m.cxx#L268
(inactive but lurking occasionally...)
Posts: 1588
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Return to Development

Who is online

Users browsing this forum: No registered users and 0 guests