API:logEvent

From MODx Wiki

Jump to: navigation, search
 API Function Definition: 
logEvent
Versions 
> 0.9.2 ?
Return Values
Success: null
Fail: echo error and exit()
Data Type 
void
Object Hierarchy 
DocumentParser
void logEvent(int $evtid, int $type, string $msg [, $source= 'Parser']);


  • $evtid - Event ID
  • $type - types: 1 = information, 2 = warning, 3 = error
  • $msg - message to be logged
  • $source - source of the event (module, snippet name, etc.)

Examples

Related Functions

Function Source

File: manager/includes/document.parser.class.inc.php
Line: 1285
  1. # Add an a alert message to the system event log
  2. function logEvent($evtid, $type, $msg, $source= 'Parser') {
  3. $msg= mysql_escape_string($msg);
  4. $source= mysql_escape_string($source);
  5. $evtid= intval($evtid);
  6. if ($type < 1)
  7. $type= 1;
  8. else
  9. if ($type > 3)
  10. $type= 3; // Types: 1 = information, 2 = warning, 3 = error
  11. $sql= "INSERT INTO " . $this->getFullTableName("event_log") . "(eventid,type,createdon,source,description,user) " .
  12. "VALUES($evtid,$type," . time() . ",'$source','$msg','" . $this->getLoginUserID() . "')";
  13. $ds= $this->dbQuery($sql);
  14. if (!$ds) {
  15. echo "Error while inserting event log into database.";
  16. }
  17.  
  18. }

Notes

Personal tools