Zend_Log_Writer_Db Problem - Customising table columns
Hello all,
I am trying to get Zend_Log_Writer_Db set up so that I can add some custom fields into my database for logging purposes.
I am trying to get the writer to be able to put a logged in user's username into a table field named "user" along with a timestamp, message, and priority.
The code I have currently is this:
// Set up the logging system and put it in the Zend Registry.
$user = array('USERNAME'); // It is an array because I found out that the Db writer wont accept strings...
Zend_Registry::set('user', $user);
$columnMapping = array('priority' => 'priority', 'message' => 'message', 'timestamp' => 'timestamp', 'user' => $user);
$writer = new Zend_Log_Writer_Db($DB, 'log', $columnMapping);
But this returns the error:
Warning: Illegal offset type in
/usr/local/apache2/Zend/library/Zend/Log/Writer/Db.php on line 103
Can anyone help me out here?
Kind regards,
Socceroos
|