3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-05-29 13:26:31 +00:00

Logging: Add log stream that only get sent warning+ logs.

This commit is contained in:
Sean Luchen 2025-09-15 11:31:52 -07:00 committed by Miodrag Milanovic
parent ab316c14d2
commit 57a6aff194
2 changed files with 25 additions and 10 deletions

View file

@ -95,8 +95,15 @@ YOSYS_NAMESPACE_BEGIN
struct log_cmd_error_exception { };
enum LogSeverity {
LOG_INFO,
LOG_WARNING,
LOG_ERROR
};
extern std::vector<FILE*> log_files;
extern std::vector<std::ostream*> log_streams;
extern std::vector<std::ostream*> log_warning_streams;
extern std::vector<std::string> log_scratchpads;
extern std::map<std::string, std::set<std::string>> log_hdump;
extern std::vector<std::regex> log_warn_regexes, log_nowarn_regexes, log_werror_regexes;
@ -133,12 +140,10 @@ static inline bool ys_debug(int = 0) { return false; }
#endif
# define log_debug(...) do { if (ys_debug(1)) log(__VA_ARGS__); } while (0)
void log_formatted_string(std::string_view format, std::string str);
void log_formatted_string(std::string_view format, std::string str, LogSeverity severity = LogSeverity::LOG_INFO);
template <typename... Args>
inline void log(FmtString<TypeIdentity<Args>...> fmt, const Args &... args)
{
if (log_make_debug && !ys_debug(1))
return;
log_formatted_string(fmt.format_string(), fmt.format(args...));
}