1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-23 14:06:46 +00:00
openmw/components/debug/debugging.hpp
elsid 524efc4e18
Fix logging and config for portable setup
Setup logging after setting up paths but before settings loading to get proper
log records earlier.

Read configuration by navmeshtool and bulletobjecttool the same way editor and
engine do to properly handle --replace config and --config arguments.

Remove mode and autoSetupLogging arguments from setupLogging since they are no
longer used.

Use temp path to write crash logs because default paths might not be available
for portable setup.
2023-05-30 09:44:23 +02:00

44 lines
967 B
C++

#ifndef DEBUG_DEBUGGING_H
#define DEBUG_DEBUGGING_H
#include <string_view>
#include <boost/filesystem/fstream.hpp>
#include <boost/iostreams/stream.hpp>
#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();
void setupLogging(const std::string& logDir, std::string_view appName);
int wrapApplication(int (*innerApplication)(int argc, char *argv[]), int argc, char *argv[],
std::string_view appName);
#endif