Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow prevention of log file reuse. #238

Merged
merged 3 commits into from
Mar 12, 2014
Merged

Allow prevention of log file reuse. #238

merged 3 commits into from
Mar 12, 2014

Conversation

DarioAhdoot
Copy link
Contributor

This is nice if you want to create a new log file at every app launch.
Modification keeps backwards compatibility with existing code as it will maintain previous behavior if the reuseExistingLogFile property isn’t set.

…e a new log file at every app launch.

Modification keeps backwards compatibility with existing code as it will maintain previous behavior if the reuseExistingLogFile property isn’t set.
@@ -575,6 +575,7 @@ - (instancetype)initWithLogFileManager:(id <DDLogFileManager>)aLogFileManager
{
if ((self = [super init]))
{
_reuseLogFiles = TRUE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you change it into -> doNotReuseLogFiles this line won't be needed (default BOOL's are NO) and makes it the default value more intuitive to users by just looking at the property name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated according to your suggestions. Ready to pull.

@@ -905,7 +905,7 @@ - (DDLogFileInfo *)currentLogFileInfo
{
DDLogFileInfo *mostRecentLogFileInfo = [sortedLogFileInfos objectAtIndex:0];

BOOL useExistingLogFile = YES;
BOOL useExistingLogFile = !_doNotReuseLogFiles;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useExistingLogFile is no longer necessary, just use doNotReuseLogFiles directly.
It will also make reading the code easier for those who will pass by later ;)

Thank you for updating!

@@ -905,22 +905,18 @@ - (DDLogFileInfo *)currentLogFileInfo
{
DDLogFileInfo *mostRecentLogFileInfo = [sortedLogFileInfos objectAtIndex:0];

BOOL useExistingLogFile = YES;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated per your suggestion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! Less code = easier to maintain.

rivera-ernesto pushed a commit that referenced this pull request Mar 12, 2014
Allow prevention of log file reuse.
@rivera-ernesto rivera-ernesto merged commit 71fa7f4 into CocoaLumberjack:master Mar 12, 2014
@bpoplauschi bpoplauschi added this to the 1.9.0 milestone May 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants