#ifndef __FLOG_H__ #define __FLOG_H__ #include /* Fault log. Writes timestamped lines to a file (thread-safe). The file is * periodically truncated (by time and/or by size). */ int flog_init(const char *path, long rotate_ms, long max_bytes); void flog_shutdown(void); int flog_enabled(void); /* Append one fault entry: "[YYYY-MM-DD HH:MM:SS] msg" */ void flog(const char *fmt, ...); /* Rate-limited flog: same 'cat' logs at most once per min_interval_ms. * Replaces high-frequency call sites (commit/compose/decode failures). */ void flog_throttled(const char *cat, long min_interval_ms, const char *fmt, ...); /* Call periodically (e.g. once per main-loop tick): truncates the log when * rotate_ms elapsed or file exceeds max_bytes. */ void flog_rotate_check(void); #endif