MCPcopy Create free account
hub / github.com/OpenMW/openmw / setupLogging

Function setupLogging

components/debug/debugging.cpp:399–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397 }
398
399 void setupLogging(const std::filesystem::path& logDir, std::string_view appName)
400 {
401 Log::sMinDebugLevel = getDebugLevel();
402 Log::sWriteLevel = true;
403
404#if !(defined(_WIN32) && defined(_DEBUG))
405 const std::string logName = Misc::StringUtils::lowerCase(appName) + ".log";
406 logfile.open(logDir / logName, std::ios::out);
407
408 Identity log(logfile);
409
410 for (const Record& v : globalBuffer)
411 log.write(v.mValue.data(), v.mValue.size(), v.mLevel);
412
413 globalBuffer.clear();
414
415 standardOut.open(Tee(log, Coloured(*rawStdout)));
416 standardErr.open(Tee(log, Coloured(*rawStderr)));
417
418 std::cout.rdbuf(&standardOut);
419 std::cerr.rdbuf(&standardErr);
420#endif
421
422#ifdef _WIN32
423 if (Crash::CrashCatcher::instance())
424 {
425 Crash::CrashCatcher::instance()->updateDumpPath(logDir);
426 }
427#endif
428 }
429
430 int wrapApplication(
431 int (*innerApplication)(int argc, char* argv[]), int argc, char* argv[], std::string_view appName)

Callers 6

readConfigurationMethod · 0.85
runNavMeshToolFunction · 0.85
runWizardFunction · 0.85
runLauncherFunction · 0.85
runBulletObjectToolFunction · 0.85
parseOptionsFunction · 0.85

Calls 10

getDebugLevelFunction · 0.85
lowerCaseFunction · 0.85
TeeClass · 0.85
ColouredClass · 0.85
updateDumpPathMethod · 0.80
openMethod · 0.45
writeMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected