Best way to handle Fatal Errors in PHP 5.3 and Slim 2

I’m trying to log all the fatal errors in my application. I’m using Slim 2 and PHP 5.3.

I am planning to use register_shutdown_function to log the error in my database.

Where would be the right place to put register_shutdown_function function(“fatalErrorLogging”) ? How about the actual fatalErrorLogging function ?

Right now I am thinking about these options: index.php or middleware or even on all the routes?