Skip to content

Commit a9e3de3

Browse files
committed
fix(Log): adjust logging behavior for RetroDECK and regular builds to prevent duplicate messages
1 parent 47a0571 commit a9e3de3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

es-core/src/Log.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,17 @@ Log::~Log()
172172
mOutStringStream.str().c_str());
173173
}
174174
#else
175-
// If it's an error or the --debug flag has been set, then print to the console as well.
175+
// For regular builds (non-RetroDECK) print to stderr when it's an error
176+
// or the reporting level is Debug. On RetroDECK we always write logs to
177+
// the terminal via stdout instead, to avoid duplicate messages (stderr+stdout).
178+
#if !defined(RETRODECK)
176179
if (mMessageLevel == LogError || sReportingLevel >= LogDebug)
177180
std::cerr << mOutStringStream.str();
178181
#endif
182+
#endif
179183
#if defined(RETRODECK)
180-
// Always write logs to the terminal as well when RetroDECK is defined
184+
// Write logs to the terminal (stdout) for RetroDECK builds. Avoid using
185+
// stderr here to prevent duplicate logging when reporting level is Debug.
181186
std::cout << mOutStringStream.str();
182187
#endif
183188
}

0 commit comments

Comments
 (0)