Prev | Current Page 605 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

writeBytes( str, 0, str.length );
stream.flush();
// close stream
stream.close();
}
And that ??™ s it. Your Logger class is now complete. All that ??™ s left is to update the Exception class to cater
for writes through the logger. Now, you might not always want to perform a log within an exception,
especially if the output for the class is not Neko based. Therefore, a flag will need to be set to force the
log entry. Another point worth considering is that you might not want all exceptions logged, so setting
this flag as a static variable is probably not the best option. So what do you do?
Probably, the best course of action is to simply provide a log function that can be called ??” or not,
whatever the case may be ??” when the exception is caught.
314
Part II: Server Side, JavaScript, and Flash: Oh My!
public function log()
{
#if neko
Logger.log( this.toString(), true );
#end
}
Summary
This chapter provided a good foundation for dealing with input and output in Neko applications.
Specifically, you learned:
Which database will best suit your type of Neko application
How to access and modify data in a database
How to use the SPOD framework
How to work with files and streams
How to create a logging class
In the next chapter, you look at building interactive client content for the Flash platform .


Pages:
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617