View Source

\\
h2. xPDO::log

Log a message with details about where and when an event occurs.

h2. Syntax
API Docs: http://api.modxcms.com/xpdo/xPDO.html#log

{code}
void log (integer $level, string $msg, [string $target = ''], [string $def = ''], [string $file = ''], [string $line = ''])
{code}

h2. Log Levels

In many cases, you can use the MODX equivalent constants for log levels.

||xPDO Constant||MODX Constant||Value||
|xPDO::LOG_LEVEL_FATAL|MODX_LOG_LEVEL_FATAL|0|
|xPDO::LOG_LEVEL_ERROR|MODX_LOG_LEVEL_ERROR|1|
|xPDO::LOG_LEVEL_WARN|MODX_LOG_LEVEL_WARN|2|
|xPDO::LOG_LEVEL_INFO|MODX_LOG_LEVEL_INFO|3|
|xPDO::LOG_LEVEL_DEBUG|MODX_LOG_LEVEL_DEBUG|4|


h2. Example

Log an error message:
{code}
$xpdo->log(xPDO::LOG_LEVEL_ERROR,'An error occurred.');
{code}

Log a debug message:
{code}
$xpdo->log(xPDO::LOG_LEVEL_DEBUG,'This is a debugging statement.');
{code}

h2. See Also
* [xPDO]

{scrollbar}