mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2026-05-31 00:00:10 +08:00
Added logging APIs
This commit is contained in:
@@ -67,6 +67,8 @@ NSString* GCDWebServerGetPrimaryIPv4Address(); // Returns IPv4 address of prima
|
|||||||
@interface GCDWebServer (Extensions)
|
@interface GCDWebServer (Extensions)
|
||||||
@property(nonatomic, readonly) NSURL* serverURL; // Only non-nil if server is running
|
@property(nonatomic, readonly) NSURL* serverURL; // Only non-nil if server is running
|
||||||
@property(nonatomic, readonly) NSURL* bonjourServerURL; // Only non-nil if server is running and Bonjour registration is active
|
@property(nonatomic, readonly) NSURL* bonjourServerURL; // Only non-nil if server is running and Bonjour registration is active
|
||||||
|
- (void)logWarning:(NSString*)format, ... NS_FORMAT_FUNCTION(1,2);
|
||||||
|
- (void)logError:(NSString*)format, ... NS_FORMAT_FUNCTION(1,2);
|
||||||
#if !TARGET_OS_IPHONE
|
#if !TARGET_OS_IPHONE
|
||||||
- (BOOL)runWithPort:(NSUInteger)port; // Starts then automatically stops on SIGINT i.e. Ctrl-C (use on main thread only)
|
- (BOOL)runWithPort:(NSUInteger)port; // Starts then automatically stops on SIGINT i.e. Ctrl-C (use on main thread only)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -483,6 +483,24 @@ static void _NetServiceClientCallBack(CFNetServiceRef service, CFStreamError* er
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)logWarning:(NSString*)format, ... {
|
||||||
|
va_list arguments;
|
||||||
|
va_start(arguments, format);
|
||||||
|
NSString* message = [[NSString alloc] initWithFormat:format arguments:arguments];
|
||||||
|
va_end(arguments);
|
||||||
|
LOG_WARNING(@"%@", message);
|
||||||
|
ARC_RELEASE(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)logError:(NSString*)format, ... {
|
||||||
|
va_list arguments;
|
||||||
|
va_start(arguments, format);
|
||||||
|
NSString* message = [[NSString alloc] initWithFormat:format arguments:arguments];
|
||||||
|
va_end(arguments);
|
||||||
|
LOG_ERROR(@"%@", message);
|
||||||
|
ARC_RELEASE(message);
|
||||||
|
}
|
||||||
|
|
||||||
#if !TARGET_OS_IPHONE
|
#if !TARGET_OS_IPHONE
|
||||||
|
|
||||||
- (BOOL)runWithPort:(NSUInteger)port {
|
- (BOOL)runWithPort:(NSUInteger)port {
|
||||||
|
|||||||
Reference in New Issue
Block a user