SyslogWriter extends AbstractWriter
Log writer that writes to syslog
Table of Contents
Properties
- $facility : int
- Type of program that is logging to syslog.
Methods
- __construct() : mixed
- Constructor, adds facilities on *nix environments.
- __destruct() : mixed
- Destructor, closes connection to syslog.
- __wakeup() : mixed
- Deny object deserialization.
- getMessageForSyslog() : string
- Returns the data of the record in syslog format
- setFacility() : void
- Sets the facility to use when logging to syslog.
- writeLog() : WriterInterface
- Writes the log record to syslog
- formatContextValue() : string
- Escape or quote a value from the context appropriate for the output.
- formatException() : string
- Formats an exception into a string.
- interpolate() : string
- Interpolates context values into the message placeholders.
Properties
$facility
Type of program that is logging to syslog.
protected
int
$facility
= LOG_USER
Methods
__construct()
Constructor, adds facilities on *nix environments.
public
__construct([array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $options : array<string|int, mixed> = []
-
Configuration options
Tags
__destruct()
Destructor, closes connection to syslog.
public
__destruct() : mixed
__wakeup()
Deny object deserialization.
public
__wakeup() : mixed
getMessageForSyslog()
Returns the data of the record in syslog format
public
getMessageForSyslog(LogRecord $record) : string
Parameters
- $record : LogRecord
Return values
stringsetFacility()
Sets the facility to use when logging to syslog.
public
setFacility(string $facility) : void
Parameters
- $facility : string
-
Facility to use when logging.
writeLog()
Writes the log record to syslog
public
writeLog(LogRecord $record) : WriterInterface
Parameters
- $record : LogRecord
-
Log record
Tags
Return values
WriterInterfaceformatContextValue()
Escape or quote a value from the context appropriate for the output.
protected
formatContextValue(string $value) : string
Note: In some output cases, escaping should not be done here but later on output, such as if it's being written to a database for later display.
Parameters
- $value : string
Return values
stringformatException()
Formats an exception into a string.
protected
formatException(Throwable $ex) : string
The format here is nearly the same as just casting an exception to a string, but omits the full class namespace and stack trace, as those get very long.
Parameters
- $ex : Throwable
Return values
stringinterpolate()
Interpolates context values into the message placeholders.
protected
interpolate(string $message[, array<string|int, mixed> $context = [] ]) : string
Parameters
- $message : string
- $context : array<string|int, mixed> = []