mmlemon / as3corelib

Automatically exported from code.google.com/p/as3corelib
0 stars 0 forks source link

Enhancement: Use a timer to close the FileTarget log stream. More efficient during heavy logging #135

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I've attached an enhanced version of FileTarget.as, which uses an optional
timer to avoid the openFile/writeFile/closeFile cycle for every line of
output logged.

The extra file system overhead of opening / closing files for each logged
line can be very high during periods of heavy logging activity. By using a
timeout of say 500 mSecs, your app can log tons of stuff at a very fast
rate, and then the log file will be closed after 500 mSec of no logging.

The default flulsh timeout is still 0 mSecs, which is the existing
behaviour of open/write/close for each line.

But if the flushTimeoutMsecs property is set to a positive number (either
directly or in the constructor call), the timer-based logic will kick in,
for great justice!

Original issue reported on code.google.com by doug.sch...@gmail.com on 8 Jan 2010 at 6:46

Attachments: