Files
waf-platform/HttpDNSSDK/sdk/ios/NewHttpDNS/Log/HttpdnsLog_Internal.h
2026-03-05 02:44:43 +08:00

46 lines
1.2 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// HttpdnsLog_Internal.h
// NewHttpDNS
//
// Created by junmo on 2018/12/19.
// Copyright © 2018�trustapp.com. All rights reserved.
//
#import "HttpdnsLog.h"
#import "HttpdnsLoggerProtocol.h"
#import <pthread/pthread.h>
// logHandler输出日志,ä¸<C3A4>å<EFBFBD>—日志开关影å“?
#define HttpdnsLogDebug(frmt, ...) \
if ([HttpdnsLog validLogHandler]) { \
@try { \
uint64_t tid = 0; \
pthread_threadid_np(NULL, &tid); \
NSString *logFormat = [NSString stringWithFormat:@"%s", frmt]; \
NSString *logStr = [NSString stringWithFormat:@"[%llu] %@", tid, [NSString stringWithFormat:logFormat, ##__VA_ARGS__, nil]]; \
[HttpdnsLog outputToLogHandler:logStr]; \
} @catch (NSException *exception){ \
} \
} \
if ([HttpdnsLog isEnabled]) { \
@try { \
uint64_t tid = 0; \
pthread_threadid_np(NULL, &tid); \
NSLog((@"%@ HTTPDNSSDKLOG [%llu] - " frmt), [HttpdnsLog getFormattedDateTimeStr], tid, ##__VA_ARGS__); \
} @catch (NSException *exception){ \
} \
}
@interface HttpdnsLog ()
+ (void)setLogHandler:(id<HttpdnsLoggerProtocol>)handler;
+ (void)unsetLogHandler;
+ (BOOL)validLogHandler;
+ (void)outputToLogHandler:(NSString *)logStr;
+ (NSString *)getFormattedDateTimeStr;
@end