Skip to content

Commit

Permalink
gi_test/gi: fix logger not being initialized on DocTest flush
Browse files Browse the repository at this point in the history
  • Loading branch information
pablode committed Aug 4, 2024
1 parent 6d62706 commit cadad8c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/gb/impl/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ namespace gtl

void gbLogInit()
{
assert(!s_logger);
if (s_logger)
{
return;
}

quill::ConsoleColours consoleColors;
consoleColors.set_default_colours();
Expand Down
7 changes: 1 addition & 6 deletions src/gi/impl/Gi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ namespace gtl
};

bool s_cgpuInitialized = false;
bool s_loggerInitialized = false;
CgpuDevice s_device;
CgpuPhysicalDeviceFeatures s_deviceFeatures;
CgpuPhysicalDeviceProperties s_deviceProperties;
Expand Down Expand Up @@ -326,11 +325,7 @@ namespace gtl
return GiStatus::Error;
}

if (!s_loggerInitialized)
{
gbLogInit();
s_loggerInitialized = true;
}
gbLogInit();

_PrintInitInfo(params);

Expand Down
2 changes: 1 addition & 1 deletion src/gt/impl/LogFlushListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace gtl
{
// Unfortunately is it not enough to only hook report_query() or log_message().

GtLogFlushListener::GtLogFlushListener(const ContextOptions&) {}
GtLogFlushListener::GtLogFlushListener(const ContextOptions&) { gbLogInit(); }

void GtLogFlushListener::report_query(const QueryData&) { gbLogFlush(); }

Expand Down

0 comments on commit cadad8c

Please sign in to comment.