summaryrefslogtreecommitdiffstats
path: root/pokemod/Debug.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2007-05-03 23:12:56 +0000
committerBen Boeckel <MathStuf@gmail.com>2007-05-03 23:12:56 +0000
commit21cb50c82f18b3a2ee1e77a7de11413ce45e6587 (patch)
tree33d1c600c9e26756580c92ea6b331041699510eb /pokemod/Debug.cpp
parent621d0f09fafba69aa650bc1555927f41e9c8e60e (diff)
downloadsigen-21cb50c82f18b3a2ee1e77a7de11413ce45e6587.tar.gz
sigen-21cb50c82f18b3a2ee1e77a7de11413ce45e6587.tar.xz
sigen-21cb50c82f18b3a2ee1e77a7de11413ce45e6587.zip
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@7 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Debug.cpp')
-rw-r--r--pokemod/Debug.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/pokemod/Debug.cpp b/pokemod/Debug.cpp
index d160fd2b..4875bd4d 100644
--- a/pokemod/Debug.cpp
+++ b/pokemod/Debug.cpp
@@ -25,12 +25,11 @@
#ifdef PM_DEBUG
-// Declare an instance of the debug window
-#ifdef PM_DEBUG_OUTPUT_DEBUG
-debugWindow debug = new debugWindow();
+#ifdef PG_DEBUG_WINDOW
+extern debugWindow PokeModDebugWindow;
#endif
-extern int PMdebugLevel;
+int PokModDebugLevel;
void PokeGen::PokeMod::Log(const char *msg, int level)
{
@@ -40,23 +39,26 @@ void PokeGen::PokeMod::Log(const char *msg, int level)
if (level <= PMdebugLevel)
{
// Get the current time
- time_t curTimeSec = time(NULL);
- PMString curTime = asctime(localtime(&curTimeSec));
- curTime.erase(curTime.find('\n'));
+ char path[21];
+ char time[9];
+ time_t rawTime = std::time(NULL);
+ tm *curTime = std::localtime(&rawTime);
+ strftime(path, 21, "%y/%m-%b/%d-%a", curTime);
+ strftime(time, 9, "%X", curTime);
// Get the actual output message
- PMString output("%s (%s): %s", PokeModDebugStr[level], curTime.c_str(), msg);
+ String output("%s (%s): %s", PokeModDebugStr[level], time, msg);
// Output to the command window
# ifdef PM_DEBUG_OUTPUT_CONSOLE
std::cout << output << std::endl;
# endif
// Output to the debugging console
# ifdef PM_DEBUG_OUTPUT_DEBUG
- if (debug.m_Show[level].IsChecked())
- debug.m_Debug.Append(output);
+ if (PokeModDebugWindow.m_Show[level].IsChecked())
+ PokeModDebugWindow.m_Debug.Append(output);
# endif
// Output to the debugging log
# ifdef PM_DEBUG_OUTPUT_FILE
- std::ofstream flog("PokeMod.log", std::ios::app);
+ std::ofstream flog(String("/log/pokemod/%s.log", path), std::ios::app);
// Output erros if the file fails
if (!flog)
{
@@ -64,7 +66,7 @@ void PokeGen::PokeMod::Log(const char *msg, int level)
std::cout << "Alert (" << curTime << "): Unable to open log file!\n";
# endif
# ifdef PM_DEBUG_OUTPUT_DEBUG
- debug.m_Debug.Append(String("Alert (%s): Unable to open log file!", curTime));
+ PokeModDebugWindow.m_Debug.Append(String("Alert (%s): Unable to open log file!", curTime));
# endif
}
else
@@ -79,7 +81,7 @@ void PokeGen::PokeMod::Log(const char *msg, int level)
#else
// Empty function if debugging isn't wanted
-void PokeGen::PokeMod::Log(const PokeGen::PokeMod::String &msg, int level)
+void PokeGen::PokeMod::Log(const String &msg, int level)
{
return;
}