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"); SG_LOG(SG_FLIGHT, SG_ALERT, "Failed to save initial FDM property state");
} }
_ai_mgr = dynamic_cast<FGAIManager*>(globals->get_subsystem("ai-model")); _ai_mgr = globals->get_subsystem<FGAIManager>();
if (_ai_mgr) if (!_ai_mgr) {
SG_LOG(SG_FLIGHT, SG_INFO, "FDM connection to the AI manager: SUCCESS");
else
SG_LOG(SG_FLIGHT, SG_DEV_ALERT, "FDM connection to the AI manager: FAILED"); SG_LOG(SG_FLIGHT, SG_DEV_ALERT, "FDM connection to the AI manager: FAILED");
}
} }
void FDMShell::shutdown() 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 (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 // 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()); SGPath abspath(path.realpath());
terrasync_dir = abspath; terrasync_dir = abspath;
@ -494,7 +494,7 @@ void FGGlobals::append_aircraft_path(const SGPath& path)
{ {
SGPath dirPath(path); SGPath dirPath(path);
if (!dirPath.exists()) { 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; return;
} }

View file

@ -447,7 +447,7 @@ void fgInitSecureMode()
{ {
bool secureMode = true; bool secureMode = true;
if (Options::sharedInstance()->isOptionSet("allow-nasal-from-sockets")) { 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" "Network connections will be allowed full access to the simulator \n"
"including running arbitrary scripts. Ensure you have adequate security\n" "including running arbitrary scripts. Ensure you have adequate security\n"
"(such as a firewall which blocks external connections).\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 // show this message early, if we can
auto r = flightgear::showLockFileDialog(); auto r = flightgear::showLockFileDialog();
if (r == flightgear::LockFileReset) { 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(); fgDeleteLockFile();
fgSetBool("/sim/fghome-readonly", false); fgSetBool("/sim/fghome-readonly", false);
} else if (r == flightgear::LockFileQuit) { } else if (r == flightgear::LockFileQuit) {

View file

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