Re: set maximum file size
Re: set maximum file size
- Subject: Re: set maximum file size
- From: Alex Zavatone <email@hidden>
- Date: Wed, 08 Oct 2014 10:08:01 -0400
Why not check the file size before writing? If the file size > your max, then get the length of the message you are about to write and trim that many chars from the front of the file before writing.
Or append the message to your file and after writing, check the file size and trim the surplus chats from the beginning.
Do those suggestions work for you?
Sent from my iPod Touch. Please pardon typos.
On Oct 8, 2014, at 10:01 AM, 2551 <email@hidden> wrote:
> Hi folks
>
> I have an app which needs to save some of its data into a log file. I have the method set up already for creating and appending the log file. However, I'd like to limit the file size and initiate a file turn over when it reaches a certain size. What is the best way to accomplish this?
>
> I'm aware of Cocoa Lumberjack, but I really don't want to import an entire 3rd party framework for the sake of the one simple function that I need if I can avoid it.
>
> Any thoughts much appreciated.
>
>
> Best
>
>
> P
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden