MCPcopy Create free account
hub / github.com/chrxh/alien / log

Method log

source/Base/LoggingService.cpp:9–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include <algorithm>
8
9void LoggingService::log(Priority priority, std::string const& message)
10{
11 std::lock_guard<std::mutex> lock(_mutex);
12
13 auto t = std::time(nullptr);
14 auto tm = *std::localtime(&t);
15
16 std::stringstream stream;
17 stream << std::put_time(&tm, "%Y-%m-%d %H-%M-%S") << ": " << message;
18
19 auto enrichedMessage = stream.str();
20 for (auto const& callback : _callbacks) {
21 callback->newLogMessage(priority, enrichedMessage);
22 }
23}
24
25void LoggingService::registerCallBack(LoggingCallBack* callback)
26{

Callers 1

logFunction · 0.80

Calls 1

newLogMessageMethod · 0.45

Tested by

no test coverage detected