mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-14 01:19:59 +00:00
Merge branch 'where_is_my_log' into 'master'
Don't clobber game log file when we collect a stack trace. See merge request OpenMW/openmw!755
This commit is contained in:
commit
a69619a1e8
@ -43,7 +43,7 @@ namespace bfs = boost::filesystem;
|
||||
#include <sys/user.h>
|
||||
#endif
|
||||
|
||||
static const char crash_switch[] = "--cc-handle-crash";
|
||||
#include "crashcatcher.hpp"
|
||||
|
||||
static const char fatal_err[] = "\n\n*** Fatal Error ***\n";
|
||||
static const char pipe_err[] = "!!! Failed to create pipe\n";
|
||||
|
@ -9,6 +9,8 @@
|
||||
#define USE_CRASH_CATCHER 0
|
||||
#endif
|
||||
|
||||
constexpr char crash_switch[] = "--cc-handle-crash";
|
||||
|
||||
#if USE_CRASH_CATCHER
|
||||
extern void crashCatcherInstall(int argc, char **argv, const std::string &crashLogPath);
|
||||
#else
|
||||
|
@ -179,7 +179,12 @@ int wrapApplication(int (*innerApplication)(int argc, char *argv[]), int argc, c
|
||||
std::cerr.rdbuf (&sb);
|
||||
#else
|
||||
// Redirect cout and cerr to the log file
|
||||
logfile.open (boost::filesystem::path(cfgMgr.getLogPath() / logName));
|
||||
// If we are collecting a stack trace, append to existing log file
|
||||
std::ios_base::openmode mode = std::ios::out;
|
||||
if(argc == 2 && strcmp(argv[1], crash_switch) == 0)
|
||||
mode |= std::ios::app;
|
||||
|
||||
logfile.open (boost::filesystem::path(cfgMgr.getLogPath() / logName), mode);
|
||||
|
||||
coutsb.open (Debug::Tee(logfile, oldcout));
|
||||
cerrsb.open (Debug::Tee(logfile, oldcerr));
|
||||
|
Loading…
x
Reference in New Issue
Block a user