Skip to content

Commit 256ff49

Browse files
Fixing log level not being set for new threads
1 parent 8dbd2df commit 256ff49

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Src/runcpp2/CompilingLinking.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ namespace
219219

220220
//Cache logs for worker threads
221221
ssLOG_ENABLE_CACHE_OUTPUT_FOR_NEW_THREADS();
222+
int logLevel = ssLOG_GET_CURRENT_THREAD_TARGET_LEVEL();
222223

223224
//Compile async, allow compilation for all source files whether if it succeeded or not
224225
bool failedAny = false;
@@ -309,9 +310,12 @@ namespace
309310
substitutionMap,
310311
&buildDir,
311312
compileAsExecutable,
312-
&scriptInfo
313+
&scriptInfo,
314+
logLevel
313315
]()
314316
{
317+
ssLOG_SET_CURRENT_THREAD_TARGET_LEVEL(logLevel);
318+
315319
//Getting PreRun command
316320
std::string preRun =
317321
runcpp2::HasValueFromPlatformMap(profile.Compiler.PreRun) ?
@@ -434,7 +438,6 @@ namespace
434438
std::chrono::system_clock::now() + std::chrono::seconds(maxThreads < 8 ?
435439
8 :
436440
maxThreads);
437-
438441
for(int j = 0; j < actions.size(); ++j)
439442
{
440443
if(!actions.at(j).valid())

Src/runcpp2/DependenciesHelper.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ bool runcpp2::SetupDependenciesIfNeeded(const runcpp2::Data::Profile& profile,
519519

520520
//Cache logs for worker threads
521521
ssLOG_ENABLE_CACHE_OUTPUT_FOR_NEW_THREADS();
522+
int logLevel = ssLOG_GET_CURRENT_THREAD_TARGET_LEVEL();
522523

523524
//Run setup steps
524525
for(int i = 0; i < availableDependencies.size(); ++i)
@@ -535,8 +536,10 @@ bool runcpp2::SetupDependenciesIfNeeded(const runcpp2::Data::Profile& profile,
535536
std::async
536537
(
537538
std::launch::async,
538-
[i, &profile, &availableDependencies, &dependenciesLocalCopiesPaths]()
539+
[i, &profile, &availableDependencies, &dependenciesLocalCopiesPaths, logLevel]()
539540
{
541+
ssLOG_SET_CURRENT_THREAD_TARGET_LEVEL(logLevel);
542+
540543
ssLOG_INFO("Running setup commands for " << availableDependencies.at(i)->Name);
541544
if(!RunDependenciesSteps( profile,
542545
availableDependencies.at(i)->Setup,
@@ -559,7 +562,6 @@ bool runcpp2::SetupDependenciesIfNeeded(const runcpp2::Data::Profile& profile,
559562
std::chrono::system_clock::now() + std::chrono::seconds(maxThreads < 8 ?
560563
8 :
561564
maxThreads);
562-
563565
for(int j = 0; j < actions.size(); ++j)
564566
{
565567
if(!actions.at(j).valid())
@@ -604,6 +606,7 @@ bool runcpp2::BuildDependencies(const runcpp2::Data::Profile& profile,
604606

605607
//Cache logs for worker threads
606608
ssLOG_ENABLE_CACHE_OUTPUT_FOR_NEW_THREADS();
609+
int logLevel = ssLOG_GET_CURRENT_THREAD_TARGET_LEVEL();
607610

608611
//Run build steps
609612
for(int i = 0; i < availableDependencies.size(); ++i)
@@ -615,8 +618,10 @@ bool runcpp2::BuildDependencies(const runcpp2::Data::Profile& profile,
615618
std::async
616619
(
617620
std::launch::async,
618-
[i, &profile, &availableDependencies, &dependenciesLocalCopiesPaths]()
621+
[i, &profile, &availableDependencies, &dependenciesLocalCopiesPaths, logLevel]()
619622
{
623+
ssLOG_SET_CURRENT_THREAD_TARGET_LEVEL(logLevel);
624+
620625
if(!RunDependenciesSteps( profile,
621626
availableDependencies.at(i)->Build,
622627
dependenciesLocalCopiesPaths.at(i),
@@ -637,7 +642,6 @@ bool runcpp2::BuildDependencies(const runcpp2::Data::Profile& profile,
637642
std::chrono::system_clock::now() + std::chrono::seconds(maxThreads < 8 ?
638643
8 :
639644
maxThreads);
640-
641645
for(int j = 0; j < actions.size(); ++j)
642646
{
643647
if(!actions.at(j).valid())

0 commit comments

Comments
 (0)