mirror of
https://github.com/YosysHQ/yosys
synced 2026-05-25 19:36:21 +00:00
Add LogSink & LogMessage classes for a more robust sink solution.
Signed-off-by: Sean Luchen <seanluchen@google.com>
This commit is contained in:
parent
f6863b9f70
commit
b04aadfa44
3 changed files with 54 additions and 11 deletions
15
kernel/log.h
15
kernel/log.h
|
|
@ -101,9 +101,22 @@ enum LogSeverity {
|
|||
LOG_ERROR
|
||||
};
|
||||
|
||||
struct LogMessage {
|
||||
LogMessage(LogSeverity severity, std::string_view message) :
|
||||
severity(severity), timestamp(std::time(nullptr)), message(message) {}
|
||||
LogSeverity severity;
|
||||
std::time_t timestamp;
|
||||
std::string message;
|
||||
};
|
||||
|
||||
class LogSink {
|
||||
public:
|
||||
virtual void log(const LogMessage& message) = 0;
|
||||
};
|
||||
|
||||
extern std::vector<FILE*> log_files;
|
||||
extern std::vector<std::ostream*> log_streams;
|
||||
extern std::vector<std::ostream*> log_warning_streams;
|
||||
extern std::vector<LogSink*> log_sinks;
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue