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

Truncate logs #172

Merged
merged 6 commits into from
Jun 3, 2016
Merged

Truncate logs #172

merged 6 commits into from
Jun 3, 2016

Conversation

joshaber
Copy link
Contributor

@joshaber joshaber commented Jun 2, 2016

Fixes #170

unsigned long long fileLength = [handle seekToEndOfFile];
if (fileLength <= MAX_LENGTH) return [RACSignal empty];

[handle seekToFileOffset:fileLength - MAX_LENGTH];
Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

@joshaber joshaber Jun 3, 2016

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.

Copy link
Member

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

@joshaber
Copy link
Contributor Author

joshaber commented Jun 3, 2016

🍯

@joshaber joshaber merged commit 37cd028 into master Jun 3, 2016
@joshaber joshaber deleted the truncate-logs branch June 3, 2016 16:43
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.

2 participants