minor cleanups and added an icon
This commit is contained in:
@@ -73,6 +73,7 @@ int Engine::OnInit (int argc, char* argv[]) {
|
||||
LogError ("Error initializing SDL: %s", SDL_GetError ());
|
||||
exit (-1);
|
||||
}
|
||||
SDL_WM_SetCaption("Engine Initializing","Engine Initializing");
|
||||
|
||||
/* Model */
|
||||
if (mModel == NULL)
|
||||
|
||||
+4
-4
@@ -40,9 +40,6 @@ void Logging::OnDestroy () {
|
||||
* Module specific functions
|
||||
*/
|
||||
void Logging::Log (LogLevel level, const char *str, ...) {
|
||||
if (level < mPrintLevel)
|
||||
return;
|
||||
|
||||
static char msg[LOG_MAX_MESSAGE_LENGTH];
|
||||
static int last_length = LOG_MAX_MESSAGE_LENGTH;
|
||||
static int i;
|
||||
@@ -58,12 +55,15 @@ void Logging::Log (LogLevel level, const char *str, ...) {
|
||||
last_length = strlen (msg);
|
||||
assert (last_length < LOG_MAX_MESSAGE_LENGTH);
|
||||
|
||||
std::cout << msg << std::endl;
|
||||
if (level >= mPrintLevel)
|
||||
std::cout << msg << std::endl;
|
||||
|
||||
LogEntry log_entry (level, msg);
|
||||
mLogEntries.push_back (log_entry);
|
||||
|
||||
// write the logs to file
|
||||
if (mLogFileOut) {
|
||||
/// \TODO also write out the log level
|
||||
time_t timer = time(NULL);
|
||||
std::string timestr (asctime(localtime(&timer)));
|
||||
mLogFileOut << timestr.substr(0, timestr.size() - 1) << ' ' << msg << std::endl;
|
||||
|
||||
@@ -7,6 +7,12 @@ namespace Engine {
|
||||
class Module;
|
||||
|
||||
/** \brief All logging goes through this class
|
||||
*
|
||||
* Only log messages higher or equal that of mPrintLevel are printed out. When
|
||||
* a log filename was specified by Logging::SetLogFilename() then all messages
|
||||
* sent to the Logging class are written to the file.
|
||||
*
|
||||
* \TODO Add log level for files separately
|
||||
*/
|
||||
class Logging : public Module {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user