CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
logfile.h
Go to the documentation of this file.
1#pragma once
4
36
37#include <cx/fs/vfs.h>
38#include <cx/log/log.h>
40
41CX_C_BEGIN
42
48
67
69typedef struct LogFileData LogFileData;
70
71// ============================================================================
72// High Level Interface
73// ============================================================================
74
100LogDest* logfileRegister(int maxlevel, _In_opt_ strref chanfilter, _Inout_ VFS* vfs,
101 _In_ strref filename, _In_ const LogFileConfig* config,
102 _In_opt_ LogSerializer* ser);
103
104// ============================================================================
105// Low Level Interface
106// ============================================================================
107//
108// These callbacks can be used directly with logRegisterDest() for custom
109// destination handling. Most users should use the high-level interface above.
110
132LogFileData* logfileCreate(_Inout_ VFS* vfs, _In_ strref filename, _In_ const LogFileConfig* config,
133 _In_opt_ LogSerializer* ser);
134
142void logfileMsgFunc(_In_ const LogRecord* rec, _In_opt_ void* userdata);
143
150void logfileBatchFunc(uint32 batchid, _In_opt_ void* userdata);
151
157void logfileCloseFunc(_In_opt_ void* userdata);
158
160
161CX_C_END
struct LogDest LogDest
Opaque handle to a registered log destination.
Definition log.h:187
LogDest * logfileRegister(int maxlevel, strref chanfilter, VFS *vfs, strref filename, const LogFileConfig *config, LogSerializer *ser)
void logfileBatchFunc(uint32 batchid, void *userdata)
void logfileCloseFunc(void *userdata)
void logfileMsgFunc(const LogRecord *rec, void *userdata)
struct LogFileData LogFileData
Opaque handle for file logging state.
Definition logfile.h:69
LogFileData * logfileCreate(VFS *vfs, strref filename, const LogFileConfig *config, LogSerializer *ser)
LOG_ROTATE_MODE
Log rotation mode.
Definition logfile.h:44
@ LOG_RotateTime
Rotate at specified time of day.
Definition logfile.h:46
@ LOG_RotateSize
Rotate when file exceeds rotateSize bytes.
Definition logfile.h:45
Core logging system API.
Log record serializers, independent of where the result is written.
uint8 rotateHour
Hour for LOG_RotateTime mode (0-23)
Definition logfile.h:60
int64 rotateKeepTime
Minimum time to keep rotated files (0 = no time limit)
Definition logfile.h:65
uint32 flags
Definition logfile.h:56
int rotateMode
Rotation mode from LOG_ROTATE_MODE enum.
Definition logfile.h:54
int rotateKeepFiles
Minimum number of rotated files to keep (0 = unlimited)
Definition logfile.h:64
uint8 rotateMinute
Minute for LOG_RotateTime mode (0-59)
Definition logfile.h:61
int64 rotateSize
Size threshold for LOG_RotateSize mode (bytes)
Definition logfile.h:59
uint8 rotateSecond
Second for LOG_RotateTime mode (0-59)
Definition logfile.h:62
A record serializer, owned by whichever transport it was handed to.
VFS Object.
Definition vfsobj.h:51
Virtual Filesystem (VFS)