Log something
| 53 | |
| 54 | // Log something |
| 55 | void TestbedLogger::log(Level level, const std::string& physicsWorldName, Category category, const std::string& message, const char* filename, int lineNumber) { |
| 56 | |
| 57 | // Get current time |
| 58 | auto now = std::chrono::system_clock::now(); |
| 59 | auto time = std::chrono::system_clock::to_time_t(now); |
| 60 | |
| 61 | // Get the destination file for this world |
| 62 | DefaultLogger::Destination* destination = mMapWorldToDestinations[physicsWorldName]; |
| 63 | |
| 64 | if (destination != nullptr) { |
| 65 | |
| 66 | mMutex.lock(); |
| 67 | |
| 68 | // Write the log file into the file of the corresponding scene |
| 69 | destination->write(time, physicsWorldName, message, level, category, filename, lineNumber); |
| 70 | |
| 71 | // Write the log into the standard output |
| 72 | mStandardOutputDestination->write(time, physicsWorldName, message, level, category, filename, lineNumber); |
| 73 | |
| 74 | mMutex.unlock(); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | // Return the corresponding format |
| 79 | DefaultLogger::Formatter* TestbedLogger::getFormatter(DefaultLogger::Format format) const { |