-
Notifications
You must be signed in to change notification settings - Fork 128
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
Truncate logs #172
Truncate logs #172
Conversation
unsigned long long fileLength = [handle seekToEndOfFile]; | ||
if (fileLength <= MAX_LENGTH) return [RACSignal empty]; | ||
|
||
[handle seekToFileOffset:fileLength - MAX_LENGTH]; |
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.
I don't love this, but I also couldn't find a better way to truncate from the start of a file. Since log messages are appended, we want to keep the most recent messages, i.e., the messages at the end.
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.
This doesn’t truncate in a line aware fashion which is a bummer, what do you think about taking the last N lines instead?
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.
I didn't figure it was worth the hassle. If we need to be line-aware, we either need to read the whole file (bummer if it's already big) or get a bit more complex. I'm not sure it's worth it.
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.
👌 lets roll with the minimum size
🍯 |
Fixes #170