MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ProcessLogMessage

Method ProcessLogMessage

Source/Engine/Core/Log.cpp:235–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235void Log::Logger::ProcessLogMessage(LogType type, const StringView& msg, fmt_flax::memory_buffer& w)
236{
237 const TimeSpan time = DateTime::Now() - LogStartTime;
238 fmt_flax::format(w, TEXT("[ {0} ]: [{1}] "), *time.ToString('a'), ToString(type));
239
240 // On Windows convert all '\n' into '\r\n'
241#if PLATFORM_WINDOWS
242 const int32 msgLength = msg.Length();
243 bool hasWindowsNewLine = false;
244 for (int32 i = 1; i < msgLength && !hasWindowsNewLine; i++)
245 hasWindowsNewLine |= msg.Get()[i - 1] != '\r' && msg.Get()[i] == '\n';
246 if (hasWindowsNewLine)
247 {
248 Array<Char> msgStream;
249 msgStream.EnsureCapacity(msgLength);
250 msgStream.Add(msg.Get()[0]);
251 for (int32 i = 1; i < msgLength; i++)
252 {
253 if (msg.Get()[i - 1] != '\r' && msg.Get()[i] == '\n')
254 msgStream.Add(TEXT('\r'));
255 msgStream.Add(msg.Get()[i]);
256 }
257 msgStream.Add(TEXT('\0'));
258 w.append(msgStream.Get(), (const Char*)(msgStream.Get() + msgStream.Count()));
259 //fmt_flax::format(w, TEXT("{}"), (const Char*)msgStream.Get());
260 return;
261 }
262#endif
263
264 // Output raw message to the log
265 w.append(msg.Get(), msg.Get() + msg.Length());
266 //fmt_flax::format(w, TEXT("{}"), msg);
267}
268
269void Log::Logger::Write(LogType type, const StringView& msg)
270{

Callers

nothing calls this directly

Calls 9

formatFunction · 0.70
ToStringFunction · 0.70
ToStringMethod · 0.45
LengthMethod · 0.45
GetMethod · 0.45
EnsureCapacityMethod · 0.45
AddMethod · 0.45
appendMethod · 0.45
CountMethod · 0.45

Tested by

no test coverage detected