* Fixinactive colorspaces in cg-config. Fix OpenColorIO errors that was introduced a while ago in the unit test because of requirement for config. Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com> * Reverting changes in cg-config Other warnings are not muted anymore when we check for role warnings. Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com> * Refactoring the new function in unit test log utils. Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com> * Integrating the code into LogGuard Changing some misuses of StartsWith Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com> * Adding a MuteLogging class for python side Mute log from built-in config test Comments Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com> * Adding new utilities function to mute inactive colorspace info log while not muting all logs (C++ side) Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com> * findAllAndRemove method from LogGuard now takes a regex pattern instead of just the line to find Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com> --------- Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com> Co-authored-by: Doug Walker <doug.walker@autodesk.com>
54 lines
1.4 KiB
C++
54 lines
1.4 KiB
C++
// SPDX-License-Identifier: BSD-3-Clause
|
|
// Copyright Contributors to the OpenColorIO Project.
|
|
|
|
#ifndef INCLUDED_OCIO_UNITTEST_LOGUTILS_H
|
|
#define INCLUDED_OCIO_UNITTEST_LOGUTILS_H
|
|
|
|
#include <OpenColorIO/OpenColorIO.h>
|
|
|
|
namespace OCIO_NAMESPACE
|
|
{
|
|
|
|
// Trap any log message while preserving the original logging settings.
|
|
// Note that the mechanism is not thread-safe.
|
|
class LogGuard
|
|
{
|
|
public:
|
|
LogGuard();
|
|
LogGuard(const LogGuard &) = delete;
|
|
LogGuard & operator=(const LogGuard &) = delete;
|
|
~LogGuard();
|
|
|
|
// Return the output message or null.
|
|
const std::string & output() const;
|
|
|
|
void clear();
|
|
bool empty() const;
|
|
|
|
bool findAndRemove(const std::string & str) const;
|
|
bool findAllAndRemove(const std::string & sPattern) const;
|
|
void print();
|
|
private:
|
|
LoggingLevel m_logLevel;
|
|
};
|
|
|
|
// Utility to mute the logging mechanism so the unit test output is clean.
|
|
class MuteLogging
|
|
{
|
|
public:
|
|
MuteLogging();
|
|
~MuteLogging();
|
|
};
|
|
|
|
bool checkAndMuteSceneLinearRoleError(LogGuard & logGuard);
|
|
bool checkAndMuteCompositingLogRoleError(LogGuard & logGuard);
|
|
bool checkAndMuteColorTimingRoleError(LogGuard & logGuard);
|
|
bool checkAndMuteAcesInterchangeRoleError(LogGuard & logGuard);
|
|
bool checkAndMuteDisplayInterchangeRoleError(LogGuard & logGuard);
|
|
|
|
void muteInactiveColorspaceInfo(LogGuard & logGuard);
|
|
|
|
} // namespace OCIO_NAMESPACE
|
|
|
|
#endif // INCLUDED_OCIO_UNITTEST_LOGUTILS_H
|