1
0
Fork 0

Logging: use new MANDATORY_INFO level.

Requires corresponding SG commit.
This commit is contained in:
James Turner 2020-09-06 14:57:58 +01:00
parent abb8ce0120
commit 395a3e70e9
4 changed files with 15 additions and 15 deletions

View file

@ -107,11 +107,10 @@ void FDMShell::postinit()
SG_LOG(SG_FLIGHT, SG_ALERT, "Failed to save initial FDM property state");
}
_ai_mgr = dynamic_cast<FGAIManager*>(globals->get_subsystem("ai-model"));
if (_ai_mgr)
SG_LOG(SG_FLIGHT, SG_INFO, "FDM connection to the AI manager: SUCCESS");
else
_ai_mgr = globals->get_subsystem<FGAIManager>();
if (!_ai_mgr) {
SG_LOG(SG_FLIGHT, SG_DEV_ALERT, "FDM connection to the AI manager: FAILED");
}
}
void FDMShell::shutdown()

View file

@ -459,7 +459,7 @@ void FGGlobals::set_terrasync_dir(const SGPath &path)
{
if (terrasync_dir.realpath() != SGPath(fgGetString("/sim/terrasync/scenery-dir")).realpath()) {
// if they don't match, /sim/terrasync/scenery-dir has been set by something else
SG_LOG(SG_GENERAL, SG_ALERT, "/sim/terrasync/scenery-dir is no longer stored across runs: if you wish to keep using a non-standard Terrasync directory, use --terrasync-dir or the launcher's settings");
SG_LOG(SG_GENERAL, SG_WARN, "/sim/terrasync/scenery-dir is no longer stored across runs: if you wish to keep using a non-standard Terrasync directory, use --terrasync-dir or the launcher's settings");
}
SGPath abspath(path.realpath());
terrasync_dir = abspath;
@ -494,7 +494,7 @@ void FGGlobals::append_aircraft_path(const SGPath& path)
{
SGPath dirPath(path);
if (!dirPath.exists()) {
SG_LOG(SG_GENERAL, SG_ALERT, "aircraft path not found:" << path);
SG_LOG(SG_GENERAL, SG_WARN, "aircraft path not found:" << path);
return;
}

View file

@ -447,7 +447,7 @@ void fgInitSecureMode()
{
bool secureMode = true;
if (Options::sharedInstance()->isOptionSet("allow-nasal-from-sockets")) {
SG_LOG(SG_GENERAL, SG_ALERT, "\n!! Network connections allowed to use Nasal !!\n"
SG_LOG(SG_GENERAL, SG_MANDATORY_INFO, "\n!! Network connections allowed to use Nasal !!\n"
"Network connections will be allowed full access to the simulator \n"
"including running arbitrary scripts. Ensure you have adequate security\n"
"(such as a firewall which blocks external connections).\n");
@ -575,7 +575,7 @@ int fgMainInit( int argc, char **argv )
// show this message early, if we can
auto r = flightgear::showLockFileDialog();
if (r == flightgear::LockFileReset) {
SG_LOG( SG_GENERAL, SG_ALERT, "Deleting lock file at user request");
SG_LOG( SG_GENERAL, SG_MANDATORY_INFO, "Deleting lock file at user request");
fgDeleteLockFile();
fgSetBool("/sim/fghome-readonly", false);
} else if (r == flightgear::LockFileQuit) {

View file

@ -520,8 +520,9 @@ struct SimNasalLogFileLine : SGPropertyChangeListener
bool SimNasalLogFileLine::_file_line = false;
// print() extension function. Concatenates and prints its arguments
// to the FlightGear log. Uses the highest log level (SG_ALERT), to
// make sure it appears. Is there better way to do this?
// to the FlightGear log. Uses the mandatory log level (SG_MANDATORY_INFO), to
// make sure it appears. Users should be converted to use logprint() instead,
// and specify a level explicitly.
static naRef f_print(naContext c, naRef me, int argc, naRef* args)
{
static SimNasalLogFileLine snlfl;
@ -535,7 +536,7 @@ static naRef f_print(naContext c, naRef me, int argc, naRef* args)
if (snlfl._file_line) {
/* Copy what SG_LOG() does, but use nasal file:line instead of
our own __FILE__ and __LINE__. */
if (sglog().would_log(SG_NASAL, SG_ALERT)) {
if (sglog().would_log(SG_NASAL, SG_MANDATORY_INFO)) {
int frame = 0;
const char* file = naStr_data(naGetSourceFile(c, 0));
if (simgear::strutils::ends_with( file, "/globals.nas")) {
@ -547,11 +548,10 @@ static naRef f_print(naContext c, naRef me, int argc, naRef* args)
file = naStr_data(naGetSourceFile(c, frame));
}
int line = naGetLine(c, frame);
sglog().logCopyingFilename(SG_NASAL, SG_ALERT, file, line, buf);
sglog().logCopyingFilename(SG_NASAL, SG_MANDATORY_INFO, file, line, buf);
}
}
else {
SG_LOG(SG_NASAL, SG_ALERT, buf);
} else {
SG_LOG(SG_NASAL, SG_MANDATORY_INFO, buf);
}
return naNum(buf.length());
}
@ -1057,6 +1057,7 @@ void FGNasalSys::initLogLevelConstants()
hashset(_globals, "LOG_ALERT", naNum(SG_ALERT));
hashset(_globals, "DEV_WARN", naNum(SG_DEV_WARN));
hashset(_globals, "DEV_ALERT", naNum(SG_DEV_ALERT));
hashset(_globals, "MANDATORY_INFO", naNum(SG_MANDATORY_INFO));
}
void FGNasalSys::setCmdArg(SGPropertyNode* aNode)