log_error

Description

Logs an error, if error logging is enabled.

Syntax

string log_error (string $error_message[, string $error_type[, mixed $file[, mixed $line]]])



Parameter $error_message

Expected type: String
Description: The error message



Parameter $error_type

Expected type: Enumerated String
Description: The type of error (used for filtering in the error log)

Possible string values
Allowed values Description
'critical' A critical error
'database' A database-related error
'general' A generic error (default value)
'template' A template error, such as a parse error
'undefined_vars' "Undefined index" and "Undefined variable" errors
'user' User-specific errors, such as "password incorrect"



Parameter $file

Expected type: Mixed
Description: The file where this error occurred (either null or the name of a file)

Allowed types for $file
Allowed values Description
Null Default value
String The full path to the file



Parameter $line

Expected type: Mixed
Description: The line number where this error occurred

Allowed types for $line
Allowed values Description
Null Default value
Integer The line number where the error occurred



Return value

Expected type: String
Description: Returns the error message with additional information about the file and line number.


Notes

  • Depends on the enableErrorLogging setting.
  • Filename and line should be __FILE__ and __LINE__, respectively.
  • Returns the error message. (ie. die(log_error($msg));)
Advertisement: