void logprintf(const char *format, ...) { char buffer[4096]; size_t bufferStart = 0; if(LogType::current) { strcpy(buffer, LogType::current->typeName); bufferStart = strlen(buffer); buffer[bufferStart] = ':'; buffer[bufferStart+1] = ' '; bufferStart += 2; } va_list s; va_start( s, format ); dVsprintf(buffer + bufferStart, sizeof(buffer) - bufferStart, format, s); for(LogConsumer *walk = LogConsumer::getLinkedList(); walk; walk = walk->getNext()) walk->logString(buffer); va_end(s); Platform::outputDebugString(buffer); Platform::outputDebugString("\n"); }
// Find all logs that are listenting to a specified MessageType and forward the message to them. Static method. void LogConsumer::logString(LogConsumer::MsgType msgType, std::string message) { for(LogConsumer *walk = LogConsumer::getLinkedList(); walk; walk = walk->getNext()) if(walk->mMsgTypes & msgType) // Only log to the requested type of logfile walk->prepareAndLogString(message); }