9static const char* expected[] = {
"com.test.tags.first",
"com.test.tags.second",
10 "com.test.tags.second",
"com.test.tags.first" };
11static size_t received = 0;
12static BOOL success = TRUE;
16 if (!msg || (received >= ARRAYSIZE(expected)))
21 if (strcmp(msg->PrefixString, expected[received]) != 0)
23 (void)fprintf(stderr,
"message %" PRIuz
" '%s' came under %s, expected %s\n", received,
24 msg->FormatString, msg->PrefixString, expected[received]);
31static BOOL ignore(WINPR_ATTR_UNUSED
const wLogMessage* msg)
36int TestWLogTags(WINPR_ATTR_UNUSED
int argc, WINPR_ATTR_UNUSED
char* argv[])
38 wLog* root = WLog_GetRoot();
39 if (!WLog_SetLogAppenderType(root, WLOG_APPENDER_CALLBACK))
42 wLogAppender* appender = WLog_GetLogAppender(root);
47 .data = ignore, .image = ignore, .message = message, .package = ignore
49 if (!WLog_ConfigureAppender(appender,
"callbacks", (
void*)&callbacks))
52 wLogLayout*
layout = WLog_GetLogLayout(root);
53 if (!WLog_Layout_SetPrefixFormat(root, layout,
"%mn"))
55 if (!WLog_OpenAppender(root))
58 for (
size_t x = 0; x < ARRAYSIZE(expected); x++)
60 if (!WLog_SetLogLevel(WLog_Get(expected[x]), WLOG_TRACE))
64 WLog_INFO(
"com.test.tags.first",
"first");
65 WLog_INFO(
"com.test.tags.second",
"second");
66 WLog_ERR(
"com.test.tags.second",
"an error");
67 WLog_DBG(
"com.test.tags.first",
"first again");
69 if (!WLog_CloseAppender(root))
72 if (received != ARRAYSIZE(expected))
74 (void)fprintf(stderr,
"%" PRIuz
" messages, expected %" PRIuz
"\n", received,
78 return success ? 0 : -1;
Layout layout(float leftWidth, float leftHeight, float rightWidth, float rightHeight, float width, float margin)