fix: separate screen-only logging from file logging
- Add log_write_screen() for status/stats output (stderr only) - Change STATUS line to use log_write_screen (not in log file) - SIGNAL, ORDER, FILL, FILLED/FAILED still go to both screen and log file - Log file at /tmp/engine.log
This commit is contained in:
parent
46084de4b2
commit
8739c871d5
|
|
@ -170,7 +170,7 @@ bool evaluate_symbol(evaluator_t *ev, uint16_t symbol_idx, int64_t t_sock_arrive
|
||||||
int64_t now = now_ms();
|
int64_t now = now_ms();
|
||||||
if (now - last_status_ms >= 30000) {
|
if (now - last_status_ms >= 30000) {
|
||||||
last_status_ms = now;
|
last_status_ms = now;
|
||||||
log_write("[STATUS] evals=%lu signals=%lu "
|
log_write_screen("[STATUS] evals=%lu signals=%lu "
|
||||||
"best=%.2f bps (%s) | %u triangles\n",
|
"best=%.2f bps (%s) | %u triangles\n",
|
||||||
(unsigned long)ev->stats.triangles_evaluated,
|
(unsigned long)ev->stats.triangles_evaluated,
|
||||||
(unsigned long)ev->stats.signals_fired,
|
(unsigned long)ev->stats.signals_fired,
|
||||||
|
|
|
||||||
|
|
@ -106,3 +106,11 @@ void log_write(const char *fmt, ...) {
|
||||||
write(log_pipe[1], buf, (size_t)total);
|
write(log_pipe[1], buf, (size_t)total);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Write to stderr only — skip the log file. */
|
||||||
|
void log_write_screen(const char *fmt, ...) {
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vfprintf(stderr, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,14 @@ void log_init(void);
|
||||||
/* Shut down the writer thread and close the pipe. */
|
/* Shut down the writer thread and close the pipe. */
|
||||||
void log_shutdown(void);
|
void log_shutdown(void);
|
||||||
|
|
||||||
/* Write a formatted log line to stderr with timestamp and newline.
|
/* Write a formatted log line to stderr AND log file (if configured).
|
||||||
* Non-blocking after log_init(); falls back to synchronous fprintf. */
|
* Non-blocking after log_init(); falls back to synchronous fprintf. */
|
||||||
void log_write(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
|
void log_write(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
|
||||||
|
|
||||||
|
/* Write to stderr ONLY (skip log file). For status/stats that shouldn't
|
||||||
|
* clutter the execution log file. */
|
||||||
|
void log_write_screen(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
|
||||||
|
|
||||||
/* Set a log file path. Must be called before the first log_write. */
|
/* Set a log file path. Must be called before the first log_write. */
|
||||||
void log_set_file(const char *path);
|
void log_set_file(const char *path);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue