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

Method print

src/Diagnostics/src/LogTerminal.cpp:58–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56 }
57
58 void LogTerminal::print(Level level, std::string_view message)
59 {
60 if (!passesLevelFilter(level))
61 {
62 return;
63 }
64
65 std::string timestamp;
66 if (getWriteTimestamps())
67 {
68 auto now = std::chrono::system_clock::now();
69 timestamp = fmt::format("[{:%Y-%m-%d %H:%M:%S}] ", std::chrono::floor<std::chrono::seconds>(now));
70 }
71
72 const int intendSize = getIntendSize();
73
74 if (_vt100Enabled)
75 {
76 fmt::print(getOutputStream(level), getTextStyle(level), "{}{:>{}}\n", timestamp, message, intendSize);
77 }
78 else
79 {
80 fmt::print(getOutputStream(level), "{}{}{:<{}}\n", timestamp, getLevelPrefix(level), message, intendSize);
81 }
82 }
83
84}

Callers

nothing calls this directly

Calls 5

passesLevelFilterFunction · 0.85
printFunction · 0.85
getOutputStreamFunction · 0.85
getTextStyleFunction · 0.85
getLevelPrefixFunction · 0.85

Tested by

no test coverage detected