Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

syslog

Description

The syslog of Network for PHP generate a system log message.

Syntax

syslog(
    int $priority,
    string $message
): true

Parameters

priority

A combination of the facility and the level.

Constant (descending order)Description
LOG_EMERGsystem is unusable
LOG_ALERTaction must be taken immediately
LOG_CRITcritical conditions
LOG_ERRerror conditions
LOG_WARNINGwarning conditions
LOG_NOTICEnormal, but significant, condition
LOG_INFOinformational message
LOG_DEBUGdebug-level message

message

The message to send.

Return

Always returns true.

Examples

1 · priority message

<?

function authorized_client()
{
    return false;
}

$prefix = "myprefix";
$flags = LOG_PID | LOG_PERROR;
$facility = LOG_USER;

openlog($prefix, $flags, $facility);

    if(authorized_client())
    {
        echo "authorized client";
    }
    else
    {
        $priority = LOG_WARNING;
        $message = "unauthorized client";
    
        $return = syslog($priority, $message);
    
        var_export($return);
    }

closelog();

?>
true
HomeMenu