[fpc-devel] TCustomApplication.Log(?)

Michael Van Canneyt michael at freepascal.org
Mon Feb 15 22:04:06 CET 2010

On Mon, 15 Feb 2010, Joost van der Sluis wrote:

> Hi all,
> I want to add (abstract) logging functionality to TCustomApplication. I
> see three options:
> One:
> Add a public TEventLog property to TCustomApplication. Then deratives of
> TCustumApplication can return a TEventLog or a derivate of it. I can
> leave the TEventLog property nil for TCustomApplication, or let it
> return an instance TEventLog. That way you can adda log-message as
> follows:
> Application.Eventlog.Log(EtInfo);
> Two:
> Add an abstract (or maybe better, an empty) procedure to
> TCustomApplication, procedure Log(AType: TEventType; Message: string);
> virtual; (abstract);
> I can leave out the AType parameter, but I think it's useful for all
> cases. Classes derived from TCustomApplication can implement their own
> handling.
> Three:
> Same as two, but also add a real implementation using TEventLog. So that
> by default everything is logged to the system log, or when the user
> wants to to a file.

Don't add the eventlog unit to customapplication, because eventlog has a 
dependency on the C library, and custapp does not need that.

But it would be good if the 2 implementations use the same TEventType type for
easy re-routing, so that would need to be moved 'up' somewhere.


More information about the fpc-devel mailing list