內容目录

上一个主题

< Class Phalcon\Logger\Adapter\Stream

下一个主题

Class Phalcon\Logger\Exception >

Phalcon玩家群:150237524Phalcon玩家

Class Phalcon\Logger\Adapter\Syslog

extends abstract class Phalcon\Logger\Adapter

implements Phalcon\Logger\AdapterInterface

Source on GitHub

Sends logs to the system logger

<?php

use Phalcon\Logger;
use Phalcon\Logger\Adapter\Syslog;

// LOG_USER is the only valid log type under Windows operating systems
$logger = new Syslog(
    "ident",
    [
        "option"   => LOG_CONS | LOG_NDELAY | LOG_PID,
        "facility" => LOG_USER,
    ]
);

$logger->log("This is a message");
$logger->log(Logger::ERROR, "This is an error");
$logger->error("This is another error");

Methods

public __construct (string $name, [array $options])

Phalcon\Logger\Adapter\Syslog constructor

public getFormatter ()

Returns the internal formatter

public logInternal (mixed $message, mixed $type, mixed $time, array $context)

Writes the log to the stream itself

public close ()

Closes the logger

public setLogLevel (mixed $level) inherited from Phalcon\Logger\Adapter

Filters the logs sent to the handlers that are less or equal than a specific level

public getLogLevel () inherited from Phalcon\Logger\Adapter

Returns the current log level

public setFormatter (Phalcon\Logger\FormatterInterface $formatter) inherited from Phalcon\Logger\Adapter

Sets the message formatter

public begin () inherited from Phalcon\Logger\Adapter

Starts a transaction

public commit () inherited from Phalcon\Logger\Adapter

Commits the internal transaction

public rollback () inherited from Phalcon\Logger\Adapter

Rollbacks the internal transaction

public isTransaction () inherited from Phalcon\Logger\Adapter

Returns the whether the logger is currently in an active transaction or not

public critical (mixed $message, [array $context]) inherited from Phalcon\Logger\Adapter

Sends/Writes a critical message to the log

public emergency (mixed $message, [array $context]) inherited from Phalcon\Logger\Adapter

Sends/Writes an emergency message to the log

public debug (mixed $message, [array $context]) inherited from Phalcon\Logger\Adapter

Sends/Writes a debug message to the log

public error (mixed $message, [array $context]) inherited from Phalcon\Logger\Adapter

Sends/Writes an error message to the log

public info (mixed $message, [array $context]) inherited from Phalcon\Logger\Adapter

Sends/Writes an info message to the log

public notice (mixed $message, [array $context]) inherited from Phalcon\Logger\Adapter

Sends/Writes a notice message to the log

public warning (mixed $message, [array $context]) inherited from Phalcon\Logger\Adapter

Sends/Writes a warning message to the log

public alert (mixed $message, [array $context]) inherited from Phalcon\Logger\Adapter

Sends/Writes an alert message to the log

public log (mixed $type, [mixed $message], [array $context]) inherited from Phalcon\Logger\Adapter

Logs messages to the internal logger. Appends logs to the logger