* Adsk Contrib - Add processor caches and improve the context variable support Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com> * Fix merge issues with the Grading pull request Signed-off-by: Patrick Hodoul <patrick.hodoul@autodesk.com> * Follow up on conflicting merges Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com> * Some changes following the code review Signed-off-by: Patrick Hodoul <Patrick.Hodoul@autodesk.com>
69 lines
1.0 KiB
C++
69 lines
1.0 KiB
C++
// SPDX-License-Identifier: BSD-3-Clause
|
|
// Copyright Contributors to the OpenColorIO Project.
|
|
|
|
|
|
#include <OpenColorIO/OpenColorIO.h>
|
|
|
|
#include "UnitTestLogUtils.h"
|
|
|
|
namespace OCIO_NAMESPACE
|
|
{
|
|
|
|
namespace
|
|
{
|
|
|
|
void MuteLoggingFunction(const char *)
|
|
{
|
|
// Does nothing on purpose.
|
|
}
|
|
|
|
static std::string g_output;
|
|
void CustomLoggingFunction(const char * message)
|
|
{
|
|
g_output += message;
|
|
}
|
|
|
|
} // anon.
|
|
|
|
LogGuard::LogGuard()
|
|
: m_logLevel(GetLoggingLevel())
|
|
{
|
|
SetLoggingLevel(LOGGING_LEVEL_DEBUG);
|
|
SetLoggingFunction(&CustomLoggingFunction);
|
|
}
|
|
|
|
LogGuard::~LogGuard()
|
|
{
|
|
ResetToDefaultLoggingFunction();
|
|
SetLoggingLevel(m_logLevel);
|
|
g_output.clear();
|
|
}
|
|
|
|
const std::string & LogGuard::output() const
|
|
{
|
|
return g_output;
|
|
}
|
|
|
|
void LogGuard::clear()
|
|
{
|
|
g_output.clear();
|
|
}
|
|
|
|
bool LogGuard::empty() const
|
|
{
|
|
return g_output.empty();
|
|
}
|
|
|
|
MuteLogging::MuteLogging()
|
|
{
|
|
SetLoggingFunction(&MuteLoggingFunction);
|
|
}
|
|
|
|
MuteLogging::~MuteLogging()
|
|
{
|
|
ResetToDefaultLoggingFunction();
|
|
}
|
|
|
|
} // namespace OCIO_NAMESPACE
|
|
|