|
|||
|
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 |
|
|||
|
I did get it working. Here's the code I used:
Code:
// Set up the logging system and put it in the Zend Registry.
$columnMapping = array('priority' => 'priority', 'message' => 'message',
'timestamp' => 'timestamp', 'username' => 'user',
'address' => 'address');
$writer = new Zend_Log_Writer_Db($DB, 'log', $columnMapping);
Socceroos |
![]() |
| Thread Tools | |
| Display Modes | |
|
|