• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: logLib - looking for feedback
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: logLib - looking for feedback


  • Subject: Re: logLib - looking for feedback
  • From: email@hidden (Guillaume Iacino)
  • Date: Fri, 13 Sep 2002 13:57:27 -0700

Hi,

This is a really cool widget that you built there. I am quite a newbie in
AppleScript and LogFile is exactly what I was looking for to incorporate
inside my script. Of course, I would have not been able to do it without
your script.

I do have aa question. Please excuse me if it is basic and more related to
AppleScript in general then your script.


*NewLog([file]) -- the file to write to; if no file exists, one will be
created.
Does it mean that if the file already exist, the file specified will be
opened the next time you use logMsg() or do I need to use reopenLog()?
In my tests if the file is already created: NewLog() fails.

What I am looking to do is to create the file first and if it already exist,
add some logs with clearing the previous one.

Thanks,

Guillaume



PS: I am running 10.2

> 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.
> -------
_______________________________________________
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.

  • Prev by Date: Re: "Open Location" and 10.2 Jaguar
  • Next by Date: RE: "Open Location" and 10.2 Jaguar
  • Previous by thread: Re: logLib - looking for feedback
  • Next by thread: Re: logLib - looking for feedback
  • Index(es):
    • Date
    • Thread