mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 11:26:42 +00:00 
			
		
		
		
	Do not write to log if log message level is greater than one speficied in the OPENMW_RECAST_MAX_LOG_LEVEL env variable. Use Error by default.
		
			
				
	
	
		
			48 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef DEBUG_DEBUGGING_H
 | 
						|
#define DEBUG_DEBUGGING_H
 | 
						|
 | 
						|
#include <filesystem>
 | 
						|
#include <functional>
 | 
						|
#include <string_view>
 | 
						|
 | 
						|
#include <components/misc/guarded.hpp>
 | 
						|
 | 
						|
#include "debuglog.hpp"
 | 
						|
 | 
						|
namespace Debug
 | 
						|
{
 | 
						|
    // ANSI colors for terminal
 | 
						|
    enum Color
 | 
						|
    {
 | 
						|
        Reset = 0,
 | 
						|
        DarkGray = 90,
 | 
						|
        Red = 91,
 | 
						|
        Yellow = 93
 | 
						|
    };
 | 
						|
 | 
						|
#ifdef _WIN32
 | 
						|
    bool attachParentConsole();
 | 
						|
#endif
 | 
						|
 | 
						|
    using LogListener = std::function<void(Debug::Level, std::string_view prefix, std::string_view msg)>;
 | 
						|
    void setLogListener(LogListener);
 | 
						|
 | 
						|
    // Can be used to print messages without timestamps
 | 
						|
    std::ostream& getRawStdout();
 | 
						|
 | 
						|
    std::ostream& getRawStderr();
 | 
						|
 | 
						|
    Misc::Locked<std::ostream&> getLockedRawStderr();
 | 
						|
 | 
						|
    Level getDebugLevel();
 | 
						|
 | 
						|
    Level getRecastMaxLogLevel();
 | 
						|
 | 
						|
    // Redirect cout and cerr to the log file
 | 
						|
    void setupLogging(const std::filesystem::path& logDir, std::string_view appName);
 | 
						|
 | 
						|
    int wrapApplication(
 | 
						|
        int (*innerApplication)(int argc, char* argv[]), int argc, char* argv[], std::string_view appName);
 | 
						|
}
 | 
						|
 | 
						|
#endif
 |