mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-06 06:03:23 +00:00
Added log_spacer()
This commit is contained in:
parent
674f421b47
commit
dbdf89c705
3 changed files with 20 additions and 2 deletions
|
@ -45,6 +45,7 @@ int string_buf_size = 0;
|
|||
|
||||
static struct timeval initial_tv = { 0, 0 };
|
||||
static bool next_print_log = false;
|
||||
static int log_newline_count = 0;
|
||||
|
||||
void logv(const char *format, va_list ap)
|
||||
{
|
||||
|
@ -55,6 +56,15 @@ void logv(const char *format, va_list ap)
|
|||
|
||||
std::string str = vstringf(format, ap);
|
||||
|
||||
if (str.empty())
|
||||
return;
|
||||
|
||||
size_t nnl_pos = str.find_last_not_of('\n');
|
||||
if (nnl_pos == std::string::npos)
|
||||
log_newline_count += SIZE(str);
|
||||
else
|
||||
log_newline_count = SIZE(str) - nnl_pos - 1;
|
||||
|
||||
if (log_hasher)
|
||||
log_hasher->update(str);
|
||||
|
||||
|
@ -92,7 +102,7 @@ void logv_header(const char *format, va_list ap)
|
|||
{
|
||||
bool pop_errfile = false;
|
||||
|
||||
log("\n");
|
||||
log_spacer();
|
||||
if (header_count.size() > 0)
|
||||
header_count.back()++;
|
||||
|
||||
|
@ -160,6 +170,12 @@ void log_cmd_error(const char *format, ...)
|
|||
logv_error(format, ap);
|
||||
}
|
||||
|
||||
void log_spacer()
|
||||
{
|
||||
while (log_newline_count < 2)
|
||||
log("\n");
|
||||
}
|
||||
|
||||
void log_push()
|
||||
{
|
||||
header_count.push_back(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue