Skip to content

Commit

Permalink
Make sure that both SYSLOG as well as ASSERT won't be fully missed ev…
Browse files Browse the repository at this point in the history
…en before the messaging engine is fully initialized
  • Loading branch information
VeithMetro committed Feb 21, 2025
1 parent 2ded528 commit b2fbdfc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Source/core/AssertionControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,17 @@ namespace Assertion {
void AssertionUnitProxy::AssertionEvent(Core::Messaging::IStore::Assert& metadata, const Core::Messaging::TextMessage& message)
{
_adminLock->Lock();

metadata.TimeStamp(Thunder::Core::Time::Now().Ticks());

// print the ASSERT to stderr if handler is not set, possibly due to the messaging engine not being fully initialized yet
if (_handler != nullptr) {
_handler->AssertionEvent(metadata, message);
}
else {
fprintf(stderr, "%s%s\n", metadata.ToString(Core::Messaging::MessageInfo::abbreviate::FULL).c_str(), message.Data().c_str());
}

_adminLock->Unlock();
}

Expand Down
1 change: 0 additions & 1 deletion Source/messaging/AssertionUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ namespace Assertion {

void AssertionUnit::AssertionEvent(Core::Messaging::IStore::Assert& metadata, const Core::Messaging::TextMessage& message)
{
metadata.TimeStamp(Thunder::Core::Time::Now().Ticks());
Thunder::Messaging::MessageUnit::Instance().Push(metadata, &message);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/messaging/MessageUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ namespace Thunder {
{
//logging messages can happen in Core, meaning, otherside plugin can be not started yet
//those should be just printed
if (_settings.IsDirect() == true) {
if ((_settings.IsDirect() == true) || (_dispatcher == nullptr)) {
_direct.Output(messageInfo, message);
} else if (_dispatcher != nullptr) {
uint8_t serializationBuffer[TempDataBufferSize];
Expand Down

0 comments on commit b2fbdfc

Please sign in to comment.