MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / initialize

Function initialize

src/OpenLoco/src/Logging.cpp:97–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95 }
96
97 void initialize(std::string_view logLevels)
98 {
99 const auto logsFolder = getLogsFolderPath();
100 cleanupLogFiles(logsFolder);
101
102 const auto logLevelMask = parseLogLevels(logLevels);
103
104 // Setup sink for the terminal/console.
105 _terminalLogSink = std::make_shared<LogTerminal>();
106 _terminalLogSink->setWriteTimestamps(false);
107 _terminalLogSink->setLevelMask(logLevelMask);
108 Logging::installSink(_terminalLogSink);
109
110 // Setup log file sink.
111 const auto logFile = logsFolder / getLogFileName();
112 _fileLogSink = std::make_shared<LogFile>(logFile);
113 _fileLogSink->setWriteTimestamps(true);
114 _fileLogSink->setLevelMask(logLevelMask);
115 Logging::installSink(_fileLogSink);
116 }
117
118 void shutdown()
119 {

Callers 1

mainFunction · 0.70

Calls 7

getLogsFolderPathFunction · 0.85
cleanupLogFilesFunction · 0.85
parseLogLevelsFunction · 0.85
installSinkFunction · 0.85
getLogFileNameFunction · 0.85
setWriteTimestampsMethod · 0.80
setLevelMaskMethod · 0.80

Tested by

no test coverage detected