Skip to content

Commit 4121967

Browse files
committed
do not return early in highsLogUser if there are (log) callbacks
1 parent 1c48aa8 commit 4121967

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

highs/io/HighsIO.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,12 @@ std::array<char, 32> highsDoubleToString(const double val,
108108

109109
void highsLogUser(const HighsLogOptions& log_options_, const HighsLogType type,
110110
const char* format, ...) {
111-
if (!*log_options_.output_flag ||
112-
(log_options_.log_stream == NULL && !*log_options_.log_to_console))
111+
if (!*log_options_.output_flag)
112+
return;
113+
const bool use_log_callback =
114+
log_options_.user_log_callback ||
115+
(log_options_.user_callback && log_options_.user_callback_active);
116+
if (log_options_.log_stream == NULL && !*log_options_.log_to_console && !use_log_callback)
113117
return;
114118
// highsLogUser should not be passed HighsLogType::kDetailed or
115119
// HighsLogType::kVerbose
@@ -120,9 +124,6 @@ void highsLogUser(const HighsLogOptions& log_options_, const HighsLogType type,
120124
va_list argptr;
121125
va_start(argptr, format);
122126
const bool flush_streams = true;
123-
const bool use_log_callback =
124-
log_options_.user_log_callback ||
125-
(log_options_.user_callback && log_options_.user_callback_active);
126127

127128
// Write to log file stream unless it is NULL
128129
if (log_options_.log_stream) {

0 commit comments

Comments
 (0)