CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
logmembuf.h
Go to the documentation of this file.
1#pragma once
4
30
31#include <cx/log/log.h>
33
34CX_C_BEGIN
35
41typedef struct LogMembufData {
42 uint32 size;
43 uint32 cur;
44 char* buf;
47
48// ============================================================================
49// High Level Interface
50// ============================================================================
51
74LogDest* logmembufRegister(int maxlevel, _In_opt_ strref chanfilter, uint32 size,
75 _In_opt_ LogSerializer* ser);
76
96_Ret_maybenull_ LogMembufData* logmembufData(_In_opt_ LogDest* dest);
97
98// ============================================================================
99// Low Level Interface
100// ============================================================================
101//
102// These callbacks can be used directly with logRegisterDest() for custom
103// destination handling. Most users should use the high-level interface above.
104
120_Ret_valid_ LogMembufData* logmembufCreate(uint32 size, _In_opt_ LogSerializer* ser);
121
128void logmembufMsgFunc(_In_ const LogRecord* rec, _In_opt_ void* userdata);
129
135void logmembufCloseFunc(_In_opt_ void* userdata);
136
138
139CX_C_END
struct LogDest LogDest
Opaque handle to a registered log destination.
Definition log.h:187
void logmembufCloseFunc(void *userdata)
LogMembufData * logmembufCreate(uint32 size, LogSerializer *ser)
LogDest * logmembufRegister(int maxlevel, strref chanfilter, uint32 size, LogSerializer *ser)
LogMembufData * logmembufData(LogDest *dest)
void logmembufMsgFunc(const LogRecord *rec, void *userdata)
Core logging system API.
Log record serializers, independent of where the result is written.
uint32 size
Total buffer size in bytes.
Definition logmembuf.h:42
char * buf
Buffer storage.
Definition logmembuf.h:44
uint32 cur
Current write position (number of bytes written)
Definition logmembuf.h:43
LogSerializer * ser
Owned; how a record becomes the bytes this ring stores.
Definition logmembuf.h:45
A record serializer, owned by whichever transport it was handed to.