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 <2551p...@gmail.com> 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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to