20 setvbuf(file,
nullptr, _IOLBF, 0);
44 fwrite(line, 1, len, file);
53 if (++writesSinceFlush >= flushEveryNWrites)
void shutdown() override
Releases whatever init() acquired.
void write(LogLevel level, const char *line, size_t len) override
Writes one already-formatted, newline-terminated line.
bool init(const LogConfig &config) override
Opens whatever handle/socket/file this backend needs, using only fields from config (nothing hardcode...
LogLevel
Severity of a single log call.
@ Immediate
fflush() after every write - safest against a crash/power loss, slowest
@ Never
rely on the C library / fclose() at shutdown - fastest, least crash-safe
@ EveryNWrites
fflush() every LogConfig::flushEveryNWrites writes
Full runtime configuration for the Logger.
LogFlushPolicy flushPolicy
How often the file backend flushes to storage.
char filePath[1024]
Path of the log file for the file backend. Each platform's init() points this at debug....
uint32_t flushEveryNWrites
Flush interval in writes; only used when flushPolicy is LogFlushPolicy::EveryNWrites.