Log debug
parent
ca698c3e49
commit
89584c167a
|
@ -297,8 +297,8 @@ void STEP::ReadFile(DB& db,const EXPRESS::ConversionSchema& scheme,
|
|||
}
|
||||
|
||||
if ( !DefaultLogger::isNullLogger()){
|
||||
ASSIMP_LOG_DEBUG((Formatter::format(),"STEP: got ",map.size()," object records with ",
|
||||
db.GetRefs().size()," inverse index entries"));
|
||||
ASSIMP_LOG_DEBUG_F("STEP: got ",map.size()," object records with ",
|
||||
db.GetRefs().size()," inverse index entries");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -163,15 +163,14 @@ Logger *DefaultLogger::create(const char *name /*= "AssimpLog.txt"*/,
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
void Logger::debug(const char *message) {
|
||||
|
||||
// SECURITY FIX: otherwise it's easy to produce overruns since
|
||||
// sometimes importers will include data from the input file
|
||||
// (i.e. node names) in their messages.
|
||||
if (strlen(message) > MAX_LOG_MESSAGE_LENGTH) {
|
||||
void Logger::debugInternal(Assimp::Formatter::format f) {
|
||||
std::string message = f;
|
||||
// TODO: Should limit sizes in the formatter.
|
||||
// SECURITY FIX: see above
|
||||
if (message.length() > MAX_LOG_MESSAGE_LENGTH) {
|
||||
return;
|
||||
}
|
||||
return OnDebug(message);
|
||||
return OnDebug(message.c_str());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
|
|
@ -103,7 +103,7 @@ void SplitByBoneCountProcess::Execute( aiScene* pScene)
|
|||
|
||||
if( !isNecessary )
|
||||
{
|
||||
ASSIMP_LOG_DEBUG( format() << "SplitByBoneCountProcess early-out: no meshes with more than " << mMaxBoneCount << " bones." );
|
||||
ASSIMP_LOG_DEBUG_F("SplitByBoneCountProcess early-out: no meshes with more than ", mMaxBoneCount, " bones." );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ void SplitByBoneCountProcess::Execute( aiScene* pScene)
|
|||
// recurse through all nodes and translate the node's mesh indices to fit the new mesh array
|
||||
UpdateNode( pScene->mRootNode);
|
||||
|
||||
ASSIMP_LOG_DEBUG( format() << "SplitByBoneCountProcess end: split " << mSubMeshIndices.size() << " meshes into " << meshes.size() << " submeshes." );
|
||||
ASSIMP_LOG_DEBUG_F( "SplitByBoneCountProcess end: split ", mSubMeshIndices.size(), " meshes into ", meshes.size(), " submeshes." );
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -99,10 +99,12 @@ public:
|
|||
virtual ~Logger();
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes a debug message
|
||||
* @param message Debug message*/
|
||||
void debug(const char* message);
|
||||
void debug(const std::string &message);
|
||||
/** @brief Writes a info message
|
||||
* @param message Info message*/
|
||||
template<typename... T>
|
||||
void debug(T&&... args) {
|
||||
debugInternal(Assimp::Formatter::format(), std::forward<T>(args)...);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
/** @brief Writes a debug message
|
||||
|
@ -232,22 +234,27 @@ protected:
|
|||
virtual void OnError(const char* message) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
void debugInternal(Assimp::Formatter::format f);
|
||||
void warnInternal(Assimp::Formatter::format f);
|
||||
void infoInternal(Assimp::Formatter::format f);
|
||||
void errorInternal(Assimp::Formatter::format f);
|
||||
|
||||
template<typename... T, typename U>
|
||||
void debugInternal(Assimp::Formatter::format f, U&& u, T&&... args) {
|
||||
warnInternal(std::move(f << std::forward<U>(u)), std::forward<T>(args)...);
|
||||
}
|
||||
|
||||
template<typename... T, typename U>
|
||||
void warnInternal(Assimp::Formatter::format f, U&& u, T&&... args) {
|
||||
warnInternal(std::move(f << std::forward<U>(u)), std::forward<T>(args)...);
|
||||
}
|
||||
|
||||
void infoInternal(Assimp::Formatter::format f);
|
||||
|
||||
template<typename... T, typename U>
|
||||
void infoInternal(Assimp::Formatter::format f, U&& u, T&&... args) {
|
||||
infoInternal(std::move(f << std::forward<U>(u)), std::forward<T>(args)...);
|
||||
}
|
||||
|
||||
void errorInternal(Assimp::Formatter::format f);
|
||||
|
||||
template<typename... T, typename U>
|
||||
void errorInternal(Assimp::Formatter::format f, U&& u, T&&... args) {
|
||||
errorInternal(std::move(f << std::forward<U>(u)), std::forward<T>(args)...);
|
||||
|
@ -294,12 +301,6 @@ Logger::LogSeverity Logger::getLogSeverity() const {
|
|||
return m_Severity;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline
|
||||
void Logger::debug(const std::string &message) {
|
||||
return debug(message.c_str());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline void Logger::verboseDebug(const std::string &message) {
|
||||
return verboseDebug(message.c_str());
|
||||
|
@ -315,7 +316,7 @@ inline void Logger::verboseDebug(const std::string &message) {
|
|||
Assimp::DefaultLogger::get()->error((string, __VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_DEBUG_F(string, ...) \
|
||||
Assimp::DefaultLogger::get()->debug((Assimp::Formatter::format(string), __VA_ARGS__))
|
||||
Assimp::DefaultLogger::get()->debug((string, __VA_ARGS__))
|
||||
|
||||
#define ASSIMP_LOG_VERBOSE_DEBUG_F(string, ...) \
|
||||
Assimp::DefaultLogger::get()->verboseDebug((Assimp::Formatter::format(string), __VA_ARGS__))
|
||||
|
|
|
@ -76,7 +76,7 @@ public:
|
|||
/** Start a named timer */
|
||||
void BeginRegion(const std::string& region) {
|
||||
regions[region] = std::chrono::system_clock::now();
|
||||
ASSIMP_LOG_DEBUG((format("START `"),region,"`"));
|
||||
ASSIMP_LOG_DEBUG_F("START `",region,"`");
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
}
|
||||
|
||||
std::chrono::duration<double> elapsedSeconds = std::chrono::system_clock::now() - regions[region];
|
||||
ASSIMP_LOG_DEBUG((format("END `"),region,"`, dt= ", elapsedSeconds.count()," s"));
|
||||
ASSIMP_LOG_DEBUG_F("END `",region,"`, dt= ", elapsedSeconds.count()," s");
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue