[lazarus] Debug class

Michael A. Hess mhess at miraclec.com
Mon Jul 5 19:21:53 EDT 1999


Greetings,

I have also created a Debug class for use in a FCL based project.

It is a class called TDebug.

It has the following methods:

   Write(message : string);

and the following properties:

   LogFile : String
   DebugOn : Boolean

It is a simple thing to use. All you have to do is include it in the
file that you want to have debug output. It is does a self setup so you
don't have to creat anything.

Just add udebug to your uses clause.

Then set 

  Debug.DebugOn := True;

and from then on anything that calls

  Debug.Write('your message');

will get output.

If you don't specify a LogFile then all out put goes to the console. If
you do specify a LogFile:

  Debug.LogFile := 'project.log';

Then all output goes to the file projects.log. This way you can easily
use it for console output during development and for an error log in the
actual program.

When you don't want any of the output just don't set DebugOn to True. It
is a lot cleaner then a whole lot of #ifdefs.

OK. Any want it?
-- 
==== Programming my first best destiny! ====

Michael A. Hess      Miracle Concepts, Inc.
mhess at miraclec.com   http://www.miraclec.com






More information about the Lazarus mailing list