struct rusage ru_buffer;
getrusage(RUSAGE_SELF, &ru_buffer);
- log("\nEnd of script. Logfile hash: %s, CPU: user %.2fs system %.2fs\n", hash.c_str(),
+ log_spacer();
+ log("End of script. Logfile hash: %s, CPU: user %.2fs system %.2fs\n", hash.c_str(),
ru_buffer.ru_utime.tv_sec + 1e-6 * ru_buffer.ru_utime.tv_usec,
ru_buffer.ru_stime.tv_sec + 1e-6 * ru_buffer.ru_stime.tv_usec);
log("%s\n", yosys_version_str);
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)
{
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);
{
bool pop_errfile = false;
- log("\n");
+ log_spacer();
if (header_count.size() > 0)
header_count.back()++;
logv_error(format, ap);
}
+void log_spacer()
+{
+ while (log_newline_count < 2)
+ log("\n");
+}
+
void log_push()
{
header_count.push_back(0);
void log_error(const char *format, ...) __attribute__ ((format (printf, 1, 2))) __attribute__ ((noreturn));
void log_cmd_error(const char *format, ...) __attribute__ ((format (printf, 1, 2))) __attribute__ ((noreturn));
+void log_spacer();
void log_push();
void log_pop();