Added support for third-party logging facilities

This commit is contained in:
Pierre-Olivier Latour
2014-10-13 22:45:07 -07:00
parent 5070e4fc33
commit c45053bc11
15 changed files with 367 additions and 321 deletions
@@ -77,13 +77,13 @@ static inline NSDate* _NSDateFromTimeSpec(const struct timespec* t) {
- (instancetype)initWithFile:(NSString*)path byteRange:(NSRange)range isAttachment:(BOOL)attachment {
struct stat info;
if (lstat([path fileSystemRepresentation], &info) || !(info.st_mode & S_IFREG)) {
DNOT_REACHED();
GWS_DNOT_REACHED();
ARC_RELEASE(self);
return nil;
}
#ifndef __LP64__
if (info.st_size >= (off_t)4294967295) { // In 32 bit mode, we can't handle files greater than 4 GiBs (don't use "NSUIntegerMax" here to avoid potential unsigned to signed conversion issues)
DNOT_REACHED();
GWS_DNOT_REACHED();
ARC_RELEASE(self);
return nil;
}
@@ -115,7 +115,7 @@ static inline NSDate* _NSDateFromTimeSpec(const struct timespec* t) {
if (hasByteRange) {
[self setStatusCode:kGCDWebServerHTTPStatusCode_PartialContent];
[self setValue:[NSString stringWithFormat:@"bytes %lu-%lu/%lu", (unsigned long)_offset, (unsigned long)(_offset + _size - 1), (unsigned long)fileSize] forAdditionalHeader:@"Content-Range"];
LOG_DEBUG(@"Using content bytes range [%lu-%lu] for file \"%@\"", (unsigned long)_offset, (unsigned long)(_offset + _size - 1), path);
GWS_LOG_DEBUG(@"Using content bytes range [%lu-%lu] for file \"%@\"", (unsigned long)_offset, (unsigned long)(_offset + _size - 1), path);
}
if (attachment) {
@@ -127,7 +127,7 @@ static inline NSDate* _NSDateFromTimeSpec(const struct timespec* t) {
[self setValue:value forAdditionalHeader:@"Content-Disposition"];
ARC_RELEASE(lossyFileName);
} else {
DNOT_REACHED();
GWS_DNOT_REACHED();
}
}