log: fix some functionality and wrappers

This commit is contained in:
Miodrag Milanovic 2026-08-14 12:23:25 +02:00
parent cbbd8c0dfd
commit b17b5a19e0
5 changed files with 6 additions and 3 deletions

View File

@ -5,7 +5,7 @@
int main()
{
Yosys::log_streams.push_back(&std::cout);
Yosys::log_sinks.push_back(std::make_unique<Yosys::ConsoleLogSink>());
Yosys::log_error_stderr = true;
Yosys::yosys_setup();

View File

@ -406,6 +406,7 @@ int main(int argc, char **argv)
if (log_errfile == NULL) {
log_sinks.push_back(std::make_unique<ConsoleLogSink>());
log_error_stderr = true;
} else {
log_sinks.push_back(std::make_unique<StderrLogSink>());
}

View File

@ -102,7 +102,7 @@ void FileLogSink::flush()
void ConsoleLogSink::log(const LogMessage &msg)
{
FILE *file = msg.severity == LogSeverity::LOG_ERROR ? stderr : stdout;
FILE *file = (msg.severity == LogSeverity::LOG_ERROR && log_error_stderr) ? stderr : stdout;
fputs(msg.legacy_msg.c_str(), file);
}

View File

@ -132,6 +132,8 @@ global_denylist = frozenset(
"log_verific_callback",
# incomplete type
"yosys_get_tcl_interp",
# unique ptr vector
"log_sinks",
}
)
pyosys_headers = [

View File

@ -168,7 +168,7 @@ namespace pyosys {
m.doc() = "python access to libyosys";
if (!yosys_already_setup()) {
log_streams.push_back(&std::cout);
log_sinks.push_back(std::make_unique<ConsoleLogSink>());
log_error_stderr = true;
yosys_setup();