mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2024-10-07 16:48:03 +08:00
Improved logging APIs
This commit is contained in:
parent
b942a9d2b8
commit
131810229f
@ -67,8 +67,6 @@ 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
|
||||||
@ -85,3 +83,10 @@ NSString* GCDWebServerGetPrimaryIPv4Address(); // Returns IPv4 address of prima
|
|||||||
- (void)addGETHandlerForPath:(NSString*)path filePath:(NSString*)filePath isAttachment:(BOOL)isAttachment cacheAge:(NSUInteger)cacheAge allowRangeRequests:(BOOL)allowRangeRequests; // Path is case-insensitive
|
- (void)addGETHandlerForPath:(NSString*)path filePath:(NSString*)filePath isAttachment:(BOOL)isAttachment cacheAge:(NSUInteger)cacheAge allowRangeRequests:(BOOL)allowRangeRequests; // Path is case-insensitive
|
||||||
- (void)addGETHandlerForBasePath:(NSString*)basePath directoryPath:(NSString*)directoryPath indexFilename:(NSString*)indexFilename cacheAge:(NSUInteger)cacheAge allowRangeRequests:(BOOL)allowRangeRequests; // Base path is recursive and case-sensitive
|
- (void)addGETHandlerForBasePath:(NSString*)basePath directoryPath:(NSString*)directoryPath indexFilename:(NSString*)indexFilename cacheAge:(NSUInteger)cacheAge allowRangeRequests:(BOOL)allowRangeRequests; // Base path is recursive and case-sensitive
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface GCDWebServer (Logging)
|
||||||
|
- (void)logVerbose:(NSString*)format, ... NS_FORMAT_FUNCTION(1,2);
|
||||||
|
- (void)logInfo:(NSString*)format, ... NS_FORMAT_FUNCTION(1,2);
|
||||||
|
- (void)logWarning:(NSString*)format, ... NS_FORMAT_FUNCTION(1,2);
|
||||||
|
- (void)logError:(NSString*)format, ... NS_FORMAT_FUNCTION(1,2);
|
||||||
|
@end
|
||||||
|
@ -483,24 +483,6 @@ 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 {
|
||||||
@ -681,3 +663,43 @@ static void _NetServiceClientCallBack(CFNetServiceRef service, CFStreamError* er
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@implementation GCDWebServer (Logging)
|
||||||
|
|
||||||
|
- (void)logVerbose:(NSString*)format, ... {
|
||||||
|
va_list arguments;
|
||||||
|
va_start(arguments, format);
|
||||||
|
NSString* message = [[NSString alloc] initWithFormat:format arguments:arguments];
|
||||||
|
va_end(arguments);
|
||||||
|
LOG_VERBOSE(@"%@", message);
|
||||||
|
ARC_RELEASE(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)logInfo:(NSString*)format, ... {
|
||||||
|
va_list arguments;
|
||||||
|
va_start(arguments, format);
|
||||||
|
NSString* message = [[NSString alloc] initWithFormat:format arguments:arguments];
|
||||||
|
va_end(arguments);
|
||||||
|
LOG_INFO(@"%@", message);
|
||||||
|
ARC_RELEASE(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (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);
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
Loading…
Reference in New Issue
Block a user