diff --git a/src/util/log.c b/src/util/log.c index 5f3d053..1c59f81 100644 --- a/src/util/log.c +++ b/src/util/log.c @@ -5,6 +5,8 @@ #include #include +static const char* const PREFIX_SEPARATOR = "/"; + struct log_port; struct log { @@ -51,8 +53,8 @@ struct log* log_derived(struct log* parent, const char* child_suffix) return make_log( parent->derive_rgn, rsprintf(parent->tmp_str_rgn, - "%s::%s", - parent->prefix, child_suffix), + "%s%s%s", + parent->prefix, PREFIX_SEPARATOR, child_suffix), parent->port); } @@ -95,8 +97,7 @@ void log_writeln(struct log* lg, const char* str) { pthread_mutex_lock(&lg->port->mx); if (lg->port->file) { - int pad = lg->port->padding - strlen(lg->prefix); - fprintf(lg->port->file, "%*s[%s] %s\n", pad, "", lg->prefix, str); + fprintf(lg->port->file, "%*s | %s\n", (int) lg->port->padding, lg->prefix, str); fflush(lg->port->file); } pthread_mutex_unlock(&lg->port->mx);