public function addAudit($method, $args) { $CI =& get_instance(); $CI->load->model('user_model'); $session = ''; if (isset($CI->session)) { $session = dump_s($CI->session->all_userdata()); } $this->insert(array('controller' => get_class($CI), 'method' => $method, 'user_id' => $CI->user_model->getLoginUserID(), 'session' => $session, 'args' => dump_s($args))); }
function _log_format($level, $format, $obj = null, $args = null) { if ($args == null) { $str = $format; } else { $str = vsprintf($format, $args); } $str_with_dump = $str; $cli = $this->input->is_cli_request(); if ($obj != null) { $str_with_dump .= ' --- DUMP --- :' . dump_s($obj); } switch (strtolower($level)) { case 'debug': case 'trace': if (!$cli) { $this->fb->trace($str); } $this->log->write_log('debug', $str_with_dump); break; case 'log': if (!$cli) { $this->fb->log($obj, $str); } $this->log->write_log('info', $str_with_dump); break; case 'info': if (!$cli) { $this->fb->info($obj, $str); } $this->log->write_log('info', $str_with_dump); break; case 'warn': if (!$cli) { $this->fb->warn($obj, $str); } $this->log->write_log('error', $str_with_dump); if (ENVIRONMENT != 'production') { trigger_error($str_with_dump); } break; case 'error': if (!$cli) { $this->fb->error($obj, $str); } $this->log->write_log('error', $str_with_dump); if (ENVIRONMENT != 'production') { trigger_error($str_with_dump); } break; } }