-
I just found out that asynchronous calls of spdlog::get() seems not to work as I expected. Am I doing something wrong? This is my test class:
and this is the code in my test that uses the test class:
Not always but often I catch this exception and execution of test stops before I see all three expected lines of output:
So far I have tried to create the test class instances synchronously and it works as expected: for the first instance the logger is created and all following instances get a pointer to the already existing logger. Has someone an idea what I am doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
The variable name is wrong. SpdLogTestClass()
{
m_log = spdlog::get("Test");
if (!m_log)
{
- m_logger = spdlog::stdout_color_mt("Test");
+ m_logger = spdlog::stdout_color_mt("Test");
}
} |
Beta Was this translation helpful? Give feedback.
-
seems you need to mutex protect the check+logger creation block. |
Beta Was this translation helpful? Give feedback.
seems you need to mutex protect the check+logger creation block.