Skip to content

Commit

Permalink
File logger should automatically roll log file and destroy timers if …
Browse files Browse the repository at this point in the history
…removed from logging stack.
  • Loading branch information
robbiehanson committed Dec 23, 2011
1 parent dbd06c2 commit 19fdbe1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Lumberjack/DDFileLogger.m
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,13 @@ - (void)rollLogFileNow
}

currentLogFileInfo = nil;

if (rollingTimer)
{
dispatch_source_cancel(rollingTimer);
dispatch_release(rollingTimer);
rollingTimer = NULL;
}
}

- (void)maybeRollLogFileDueToAge
Expand Down Expand Up @@ -837,6 +844,13 @@ - (void)logMessage:(DDLogMessage *)logMessage
}
}

- (void)willRemoveLogger
{
// If you override me be sure to invoke [super willRemoveLogger];

[self rollLogFileNow];
}

- (NSString *)loggerName
{
return @"cocoa.lumberjack.fileLogger";
Expand Down

0 comments on commit 19fdbe1

Please sign in to comment.