CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
logctx.h
Go to the documentation of this file.
1#pragma once
4
52
53#include <cx/log/log.h>
54#include <cx/meta/block.h>
55#include <cx/utils/macros.h>
56
57CX_C_BEGIN
58
72#define withLogCtx(...) \
73 blkWrap (_logCtxPush(count_macro_args(__VA_ARGS__), \
74 (stvar[]) { __VA_ARGS__ }), \
75 logCtxPop())
76
77// Internal; use withLogCtx()
78void _logCtxPush(int n, _In_ stvar* vars);
79
97#define withLogLocal() blkWrap(_logLocalPush(), _logLocalPop())
98
99// Internal; use withLogLocal()
100void _logLocalPush(void);
101void _logLocalPop(void);
102
106void logCtxPop(void);
107
113_Ret_opt_valid_ LogCtx* logCtxCurrent(void);
114
119_Ret_opt_valid_ LogCtx* logCtxAcquire(_In_opt_ LogCtx* ctx);
120
124void logCtxRelease(_Inout_ LogCtx** ctx);
125
139_Ret_opt_valid_ LogCtx* logCtxSwap(_In_opt_ LogCtx* ctx);
140
146void logCtxRestore(_In_opt_ LogCtx* ctx);
147
152_Ret_opt_valid_ const LogCtx* logCtxParent(_In_ const LogCtx* ctx);
153
160uint32 logCtxNumVars(_In_ const LogCtx* ctx);
161
173_Ret_valid_ const stvar* logCtxVars(_In_ const LogCtx* ctx);
174
197bool logCtxShadowed(_In_ const LogCtx* top, _In_ const LogCtx* node, uint32 idx,
198 _In_opt_z_ const char* key);
199
201
202CX_C_END
Block wrapping macros for automatic resource management.
struct LogCtx LogCtx
Opaque handle to a log context; see logctx.h.
Definition log.h:227
void logCtxRelease(LogCtx **ctx)
uint32 logCtxNumVars(const LogCtx *ctx)
const LogCtx * logCtxParent(const LogCtx *ctx)
void logCtxRestore(LogCtx *ctx)
const stvar * logCtxVars(const LogCtx *ctx)
LogCtx * logCtxAcquire(LogCtx *ctx)
LogCtx * logCtxCurrent(void)
LogCtx * logCtxSwap(LogCtx *ctx)
void logCtxPop(void)
bool logCtxShadowed(const LogCtx *top, const LogCtx *node, uint32 idx, const char *key)
#define stvar(typen, val)
Definition stvar.h:162
Core logging system API.