Skip to content

Commit

Permalink
TLOFileLogger loops each write every minute now instead of thirty sec…
Browse files Browse the repository at this point in the history
…onds.
  • Loading branch information
emsquared committed Aug 4, 2012
1 parent de0b65a commit 363c972
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 11 deletions.
1 change: 1 addition & 0 deletions Classes/Headers/NSNumberHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
+ (BOOL)compareCGFloat:(CGFloat)num1 toFloat:(CGFloat)num2;

- (NSString *)integerWithLeadingZero;
- (NSString *)integerWithLeadingZero:(NSInteger)forcedWidth;
@end
28 changes: 23 additions & 5 deletions Classes/Helpers/Cocoa (Objective-C)/NSNumberHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,34 @@ + (BOOL)compareCGFloat:(CGFloat)num1 toFloat:(CGFloat)num2
return [bleh1 isEqualToString:bleh2];
}

- (NSString *)integerWithLeadingZero:(NSInteger)forcedWidth
{
NSInteger trlzp = (forcedWidth - self.stringValue.length);

if (trlzp <= 0) {
return self.stringValue;
} else {
NSMutableString *ints = [NSMutableString string];

for (NSInteger i = 0; i < trlzp; i++) {
[ints appendString:@"0"];
}

[ints appendString:self.stringValue];

return ints;
}
}

- (NSString *)integerWithLeadingZero
{
NSString *ints = [self stringValue];
NSInteger intv = [self integerValue];

if (intv >= 0 && intv <= 9) {
return [@"0" stringByAppendingString:ints];
return [@"0" stringByAppendingString:self.stringValue];
}
return ints;

return self.stringValue;
}

@end
19 changes: 19 additions & 0 deletions Classes/IRC/IRCClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -5758,4 +5758,23 @@ + (void)load
}
}

#pragma mark -
#pragma mark Deprecated


- (BOOL)printBoth:(id)chan type:(TVCLogLineType)type nick:(NSString *)nick text:(NSString *)text identified:(BOOL)identified
{
return NO;
}

- (BOOL)printBoth:(id)chan type:(TVCLogLineType)type nick:(NSString *)nick text:(NSString *)text identified:(BOOL)identified receivedAt:(NSDate *)receivedAt
{
return NO;
}

- (BOOL)printChannel:(IRCChannel *)channel type:(TVCLogLineType)type nick:(NSString *)nick text:(NSString *)text identified:(BOOL)identified receivedAt:(NSDate *)receivedAt
{
return NO;
}

@end
6 changes: 3 additions & 3 deletions Classes/Library/TLOFileLogger.m
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ - (void)writePropertyListEntry:(NSDictionary *)s toKey:(NSString *)key
- (void)updatePropertyListCache /* @private */
{
if (self.writePlainText == NO) {
/* We loop updatePropertyListCache every thirty seconds to write any unsaved property
/* We loop updatePropertyListCache every one minute to write any unsaved property
list items to disk. Creating a property list and writing it to disk every time a new
entry is created is probably a bad idea so we save periodically. */

[self performSelector:@selector(updatePropertyListCache) withObject:nil afterDelay:30.0];
[self performSelector:@selector(updatePropertyListCache) withObject:nil afterDelay:60.0];

// ---- //

Expand Down Expand Up @@ -162,7 +162,7 @@ - (void)updatePropertyListCache /* @private */
// ---- //

if (NSObjectIsEmpty(plist) || writeError) {
DebugLogToConsole(@"Error Creating Property List: %@", writeError);
LogToConsole(@"Error Creating Property List: %@", writeError);
} else {
[_NSFileManager() createFileAtPath:self.filename
contents:plist
Expand Down
2 changes: 1 addition & 1 deletion Classes/Views/Channel View/TVCLogController.m
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ - (void)writeLine:(id)line attributes:(NSMutableDictionary *)attrs contextInfo:(
// ---- //

[self.logFile writePropertyListEntry:[context dictionaryValue]
toKey:[NSNumberWithInteger(self.lineNumber) integerWithLeadingZero]];
toKey:[NSNumberWithInteger(self.lineNumber) integerWithLeadingZero:10]];

// ---- //

Expand Down
4 changes: 2 additions & 2 deletions Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
<key>TXBundleBuildCodeName</key>
<string>Turtle Soup</string>
<key>TXBundleBuildNumber</key>
<string>12259</string>
<string>12262</string>
<key>TXBundleBuildReference</key>
<string>2.1.1-273-g928baf7-appstore</string>
<string>2.1.1-273-gde0b65a-appstore</string>
</dict>
</plist>

0 comments on commit 363c972

Please sign in to comment.