aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/log.cc3
-rw-r--r--common/log.h4
2 files changed, 7 insertions, 0 deletions
diff --git a/common/log.cc b/common/log.cc
index cbd3c171..2868e03f 100644
--- a/common/log.cc
+++ b/common/log.cc
@@ -33,6 +33,7 @@ NEXTPNR_NAMESPACE_BEGIN
std::vector<FILE *> log_files;
std::vector<std::ostream *> log_streams;
FILE *log_errfile = NULL;
+log_write_type log_write_function = nullptr;
bool log_error_stderr = false;
bool log_cmd_error_throw = false;
@@ -99,6 +100,8 @@ void logv(const char *format, va_list ap)
for (auto f : log_streams)
*f << str;
+ if (log_write_function)
+ log_write_function(str);
}
void logv_info(const char *format, va_list ap)
diff --git a/common/log.h b/common/log.h
index 8afa94d4..597b5fac 100644
--- a/common/log.h
+++ b/common/log.h
@@ -20,6 +20,7 @@
#ifndef LOG_H
#define LOG_H
+#include <functional>
#include <ostream>
#include <set>
#include <stdarg.h>
@@ -36,6 +37,8 @@
NEXTPNR_NAMESPACE_BEGIN
+typedef std::function<void(std::string)> log_write_type;
+
struct log_cmd_error_exception
{
};
@@ -43,6 +46,7 @@ struct log_cmd_error_exception
extern std::vector<FILE *> log_files;
extern std::vector<std::ostream *> log_streams;
extern FILE *log_errfile;
+extern log_write_type log_write_function;
extern bool log_quiet_warnings;
extern int log_verbose_level;