logLib - looking for feedback
logLib - looking for feedback
- Subject: logLib - looking for feedback
- From: has <email@hidden>
- Date: Tue, 10 Sep 2002 15:25:53 +0100
Hi all,
For your pleasure, I've just posted a new toy to my site at:
http://www.barple.pwp.blueyonder.co.uk/roughstuff/index.html#logLib
LogLib creates custom objects for writing log files. It can be used both as
a developer aid (it's more flexible and powerful than AS's built-in 'log'
command) and to add log-writing facilities to finished scripts (more
convenient than rolling your own). Documentation is included, as is a test
script that'll give a good idea of what it can do.
At this stage, I'm looking for comments/suggestions/feedback, etc,
particularly on how easy or hard folk find it to use (i.e. it uses an OO
design for flexibility; you don't need to know OO to use it, but if folk
are fazed at the thought then tell my why and I'll work on making it easier
to understand).
I'm also wondering how granular to make it (at the moment, it creates just
the one object type, but I could modify it to create 'basic', 'deluxe' and
'super-deluxe' log objects), and whether to encourage users to subclass it
or not (to add their own functions for logging messages with custom
formatting, indenting, etc).
So if anyone [and I do mean anyone - it's intended for easy use by anyone
from novice to propellerhead] would like to take it for a spin and mail me
on- or off-list with any thoughts, it'd be much appreciated.
-------
Now, for the more technically minded:
One issue I've run into designing logLib is the lack of destructors in AS.
Script objects already support a number of events (run, open, etc), but
there's nothing at the point when an object is dereferenced/garbage
collected [1]. This has implications for objects that need to 'clean up'
after themselves.
For example, creating a new log object in logLib opens a file for write
access. Without a destructor event, there's no way to close that file
automatically when the object is no longer used (e.g. when the script exits
or errors), thus the user must remember to close those files themselves. If
they forget, those files will remain open after the script has quit,
causing problems if [e.g.] they wish to view them in SimpleText afterwards.
To ameliorate this problem, I've added some extra stuff to logLib so that
it'll keep its own references to log objects, and provided a 'clean up
everything' function that the user can call right before the script exits,
saving them the hassle of closing logs individually. It's a kludge, and by
no means foolproof, but so far I haven't been able to come up with anything
better [2].
Again, if anyone has any thoughts, please do fire away.
-------
Cheers,
has
p.s. Check out
<
http://www.barple.pwp.blueyonder.co.uk/applications/index.html#AWPSCalendarMake
r> for another cool toy (and proof that I do sometimes write stuff that can
actually do something semi-useful by itself;).
--
[1] There's no event call made when an object is first instantiated either,
but that's much less of an issue as it's easy to work around that.
[2] No doubt I should make an enhancement request for destructor events to
be added, but can't help feeling it'd be a fairly futile exercise as the AS
team must have a thousand other requests all with higher priority than this
one...:p
--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of AppleScripts
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.