-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Conversation
…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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated per your suggestion.
There was a problem hiding this comment.
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.
Allow prevention of log file reuse.
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.