39 #include "blocxx/BLOCXX_config.h"
63 namespace BLOCXX_NAMESPACE
97 OnceFlag g_onceGuard = BLOCXX_ONCE_INIT;
98 NonRecursiveMutex* g_mutexGuard = NULL;
100 struct NullAppenderFactory
111 void initGuardAndKey()
113 g_mutexGuard =
new NonRecursiveMutex();
115 LPVOID thread_data = NULL;
116 BOOL ret = TlsSetValue(dwTlsIndex, thread_data)
136 if(threadLogAppender)
138 return threadLogAppender;
151 callOnce(g_onceGuard, initGuardAndKey);
157 return *g_defaultLogAppender;
168 callOnce(g_onceGuard, initGuardAndKey);
183 callOnce(g_onceGuard, initGuardAndKey);
189 pthread_addr_t addr_ptr = NULL;
190 int ret = pthread_getspecific(g_loggerKey, &addr_ptr);
196 ptr =
static_cast<LogAppenderRef *
>(pthread_getspecific(g_loggerKey));
214 callOnce(g_onceGuard, initGuardAndKey);
228 if (!(ret = TlsSetValue(dwTlsIndex, ptr)))
237 pthread_addr_t addr_ptr = NULL;
238 pthread_getspecific(g_loggerKey, &addr_ptr);
240 int ret = pthread_setspecific(g_loggerKey, ptr);
245 int ret = pthread_setspecific(g_loggerKey, ptr);
291 if (i != configItems.
end())
308 const String& messageFormat,
315 appender =
new NullAppender(components, categories, messageFormat);
323 appender =
new SyslogAppender(components, categories, messageFormat, identity, facility);
328 appender =
new CerrAppender(components, categories, messageFormat);
333 String filename = getConfigItem(configItems, configItem);
335 UInt64 maxFileSize(0);
348 unsigned int maxBackupIndex(0);
368 ).equalsIgnoreCase(
"true");
370 components, categories, filename.
c_str(), messageFormat,
371 maxFileSize, maxBackupIndex, flushLog
377 components, categories, filename, messageFormat,
378 maxFileSize, maxBackupIndex
402 : m_components(components.begin(), components.end())
403 , m_categories(categories.begin(), categories.end())
404 , m_formatter(pattern)
419 int nonLevelCategoryCount = numCategories - debug3Count - debug2Count - debugCount - infoCount - warningCount - errorCount - fatalCount;
421 if (numCategories == 0)
429 else if (debug3Count > 0)
433 else if (debug2Count > 0)
437 else if (debugCount > 0)
441 else if (infoCount > 0)
445 else if (warningCount > 0)
449 else if (errorCount > 0)
453 else if (fatalCount > 0)
459 BLOCXX_ASSERTMSG(0,
"Internal error. LogAppender unable to determine log level!");