Skip to content

Instantly share code, notes, and snippets.

@rubdottocom
Created May 8, 2012 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubdottocom/2633658 to your computer and use it in GitHub Desktop.
Save rubdottocom/2633658 to your computer and use it in GitHub Desktop.
CodeIgniter: Log database error function
public function log_database_error($last_query, $error_message, $error_number, $data = null)
{
log_message('debug', __METHOD__);
if ($data) {
log_message('error', "data: " . $this->str_var_dump($data));
}
log_message('error', "query: " .$last_query);
log_message('error', "DB Error: ".$error_message." (ERR_NUM: ".$error_number.")");
}
@rubdottocom
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment