---------------------------------------------------------------------------------- Creates the only singleton instance
| 124 | // ---------------------------------------------------------------------------------- |
| 125 | // Creates the only singleton instance |
| 126 | Logger *DefaultLogger::create(const char *name /*= "AssimpLog.txt"*/, |
| 127 | LogSeverity severity /*= NORMAL*/, |
| 128 | unsigned int defStreams /*= aiDefaultLogStream_DEBUGGER | aiDefaultLogStream_FILE*/, |
| 129 | IOSystem *io /*= nullptr*/) { |
| 130 | // enter the mutex here to avoid concurrency problems |
| 131 | #ifndef ASSIMP_BUILD_SINGLETHREADED |
| 132 | std::lock_guard<std::mutex> lock(loggerMutex); |
| 133 | #endif |
| 134 | |
| 135 | if (m_pLogger && !isNullLogger()) { |
| 136 | delete m_pLogger; |
| 137 | } |
| 138 | |
| 139 | m_pLogger = new DefaultLogger(severity); |
| 140 | |
| 141 | // Attach default log streams |
| 142 | // Stream the log to the MSVC debugger? |
| 143 | if (defStreams & aiDefaultLogStream_DEBUGGER) { |
| 144 | m_pLogger->attachStream(LogStream::createDefaultStream(aiDefaultLogStream_DEBUGGER)); |
| 145 | } |
| 146 | |
| 147 | // Stream the log to COUT? |
| 148 | if (defStreams & aiDefaultLogStream_STDOUT) { |
| 149 | m_pLogger->attachStream(LogStream::createDefaultStream(aiDefaultLogStream_STDOUT)); |
| 150 | } |
| 151 | |
| 152 | // Stream the log to CERR? |
| 153 | if (defStreams & aiDefaultLogStream_STDERR) { |
| 154 | m_pLogger->attachStream(LogStream::createDefaultStream(aiDefaultLogStream_STDERR)); |
| 155 | } |
| 156 | |
| 157 | // Stream the log to a file |
| 158 | if (defStreams & aiDefaultLogStream_FILE && name && *name) { |
| 159 | m_pLogger->attachStream(LogStream::createDefaultStream(aiDefaultLogStream_FILE, name, io)); |
| 160 | } |
| 161 | |
| 162 | return m_pLogger; |
| 163 | } |
| 164 | |
| 165 | // ---------------------------------------------------------------------------------- |
| 166 | void Logger::debug(const char *message) { |
nothing calls this directly
no test coverage detected