The DevShed has a very good tutorial on creating a generic error reporting PHP class that can be used in any Web application written in PHP. I will be using this in future Web apps I make for clients.
code