/** * Insert this LogEntry data into the database */ public function insert() { if ( isset( $this->fields['severity'] ) ) { $this->severity_id = LogEntry::severity( $this->fields['severity'] ); unset( $this->fields['severity'] ); } if ( isset( $this->fields['module'] ) && isset( $this->fields['type'] ) ) { $this->type_id = LogEntry::type( $this->fields['module'], $this->fields['type'] ); unset( $this->fields['module'] ); unset( $this->fields['type'] ); } // if we're set to only log entries greater than a sertain level, make sure we're that level or higher if ( $this->fields['severity_id'] < Options::get( 'log_min_severity' ) ) { return; } // make sure data is a string and can be stored. lots of times it's convenient to hand in an array of data values if ( is_array( $this->fields['data'] ) || is_object( $this->fields['data'] ) ) { $this->fields['data'] = serialize( $this->fields['data'] ); } Plugins::filter( 'insert_logentry', $this ); parent::insertRecord( DB::table( 'log' ) ); $this->id = DB::last_insert_id(); }
/** * Insert this LogEntry data into the database */ public function insert() { if (isset($this->fields['severity'])) { $this->severity_id = LogEntry::severity($this->fields['severity']); unset($this->fields['severity']); } if (isset($this->fields['module']) && isset($this->fields['type'])) { $this->type_id = LogEntry::type($this->fields['module'], $this->fields['type']); unset($this->fields['module']); unset($this->fields['type']); } Plugins::filter('insert_logentry', $this); parent::insertRecord(DB::table('log')); $this->id = DB::last_insert_id(); }