logEvent

API:logEvent

API Quick reference
Variable name: logEvent
Modx versions: 0.9.x + Evolution
Variable type: void
Object parent: DocumentParser

Description

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.)

Displays a javascript alert alert message in the web browser

Usage / Examples

Notes

Function Source

API Source File | manager/includes/document.parser.class.inc.php | 1285

# Add an a alert message to the system event log
    function logEvent($evtid, $type, $msg, $source= 'Parser') {
        $msg= mysql_escape_string($msg);
        $source= mysql_escape_string($source);
        $evtid= intval($evtid);
        if ($type < 1)
            $type= 1;
        else
            if ($type > 3)
                $type= 3; // Types: 1 = information, 2 = warning, 3 = error
        $sql= "INSERT INTO " . $this->getFullTableName("event_log") . "(eventid,type,createdon,source,description,user) " .
        "VALUES($evtid,$type," . time() . ",'$source','$msg','" . $this->getLoginUserID() . "')";
        $ds= $this->dbQuery($sql);
        if (!$ds) {
            echo "Error while inserting event log into database.";
            exit;
        }

    }

Suggest an edit to this page on GitHub (Requires GitHub account. Opens a new window/tab).