Skip to content

Commit

Permalink
always print log to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl-Robert Ernst committed May 20, 2009
1 parent 3d465f4 commit 7a9c7ec
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 32 deletions.
1 change: 0 additions & 1 deletion rts/ExternalAI/EngineOutHandler.h
Expand Up @@ -31,7 +31,6 @@ class CGroup;
struct WeaponDef;
class SkirmishAIKey;
class CSkirmishAIWrapper;
class CGroupAIWrapper;
struct SSkirmishAICallback;

void handleAIException(const char* description);
Expand Down
2 changes: 1 addition & 1 deletion rts/Game/Game.cpp
Expand Up @@ -2116,7 +2116,7 @@ void CGame::ActionReceived(const Action& action, int playernum)
}
}
}
logOutput.Print("GroupAI and LuaUI control is %s", gs->noHelperAIs ? "disabled" : "enabled");
logOutput.Print("LuaUI control is %s", gs->noHelperAIs ? "disabled" : "enabled");
}
else if (action.command == "godmode") {
if (!gs->cheatEnabled)
Expand Down
2 changes: 1 addition & 1 deletion rts/Game/SelectedUnits.cpp
Expand Up @@ -228,7 +228,7 @@ void CSelectedUnits::GiveCommand(Command c, bool fromUser)
}
else if (c.id == CMD_AISELECT) {
if (gs->noHelperAIs) {
logOutput.Print("GroupAI and LuaUI control is disabled");
logOutput.Print("LuaUI control is disabled");
return;
}
if(c.params[0]!=0){
Expand Down
2 changes: 1 addition & 1 deletion rts/Sim/Misc/GlobalSynced.h
Expand Up @@ -150,7 +150,7 @@ class CGlobalSyncedStuff
/**
* @brief disable helper AIs
*
* Whether helper AIs are allowed, including GroupAI and LuaUI control widgets
* Whether helper AIs are allowed, including LuaUI control widgets
*/
bool noHelperAIs;

Expand Down
25 changes: 7 additions & 18 deletions rts/System/LogOutput.cpp
Expand Up @@ -64,7 +64,6 @@ static vector<ILogSubscriber*> subscribers;
static const char* filename = "infolog.txt";
static std::ofstream* filelog = 0;
static bool initialized = false;
static bool stdoutDebug = false;
static boost::recursive_mutex tempstrMutex;
static string tempstr;

Expand Down Expand Up @@ -107,14 +106,6 @@ void CLogOutput::End()
}


void CLogOutput::SetMirrorToStdout(bool value)
{
GML_STDMUTEX_LOCK(log); // SetMirrorToStdout

stdoutDebug = value;
}


void CLogOutput::SetFilename(const char* fname)
{
GML_STDMUTEX_LOCK(log); // SetFilename
Expand Down Expand Up @@ -271,16 +262,14 @@ void CLogOutput::Output(const CLogSubsystem& subsystem, const char* str)
filelog->flush();
}

if (stdoutDebug) {
if (subsystem.name && *subsystem.name) {
fputs(subsystem.name, stdout);
fputs(": ", stdout);
}
fputs(str, stdout);
if (newline)
putchar('\n');
fflush(stdout);
if (subsystem.name && *subsystem.name) {
fputs(subsystem.name, stdout);
fputs(": ", stdout);
}
fputs(str, stdout);
if (newline)
putchar('\n');
fflush(stdout);
}


Expand Down
2 changes: 0 additions & 2 deletions rts/System/LogOutput.h
Expand Up @@ -118,8 +118,6 @@ class CLogOutput
void AddSubscriber(ILogSubscriber* ls);
void RemoveSubscriber(ILogSubscriber* ls);

void SetMirrorToStdout(bool);

void SetFilename(const char* filename);
void Initialize();

Expand Down
5 changes: 0 additions & 5 deletions rts/System/SpringApp.cpp
Expand Up @@ -171,8 +171,6 @@ bool SpringApp::Initialize()

ParseCmdLine();

logOutput.SetMirrorToStdout(!!configHandler->Get("StdoutDebug",0));

// log OS version
// TODO: improve version logging of non-Windows OSes
#if defined(WIN32)
Expand Down Expand Up @@ -690,9 +688,6 @@ void SpringApp::ParseCmdLine()
} else if (cmdline->result("list-skirmish-ais")) {
IAILibraryManager::OutputSkirmishAIInfo();
exit(0);
// } else if (cmdline->result("list-group-ais")) {
// IAILibraryManager::OutputGroupAIInfo();
// exit(0);
}

// flags
Expand Down
3 changes: 0 additions & 3 deletions tools/unitsync/unitsync.cpp
Expand Up @@ -228,9 +228,6 @@ EXPORT(void) Message(const char* p_szMessage)
logOutput.Print(LOG_UNITSYNC, "Message from DLL: %s\n", p_szMessage);
#ifdef WIN32
MessageBox(NULL, p_szMessage, "Message from DLL", MB_OK);
#else
// this may cause message to be printed on console twice, if StdoutDebug is on
fprintf(stderr, "unitsync: Message from DLL: %s\n", p_szMessage);
#endif
}
UNITSYNC_CATCH_BLOCKS;
Expand Down

0 comments on commit 7a9c7ec

Please sign in to comment.