Prev | Current Page 600 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


Creating a Logger Class
Working with files in Neko proves immensely useful when combined with a logging facility. In this
section, you ??™ ll now put your knowledge to work to extend the Exception class you built in Chapter 7
for use later in the book.
Let ??™ s examine the requirements for this:
The Logger class should be accessible as a separate entity from the Exception class.
The Exception class should have the full capability to write its own messages to the logger for
output.
The logger should be able to write to a file with a given name, or a file named with the current
date.
The logger should be extendable so that data can be written to alternate streams of your
choosing.
All data written to the logger should be time stamped.
Most applications have, at most, only one logger. There may be occasions when this is not so, but for the
most part you could consider this as an important design point. Therefore, when designing the logger
class, it should be necessary for much of the functionality to remain static so that all application classes
may make use of it.


Pages:
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612