public SysLog::log($level, $message, array $context = array())
Logs with an arbitrary level.
Parameters
mixed $level:
string $message:
array $context:
Return value
null
Overrides RfcLoggerTrait::log
File
- core/modules/syslog/src/Logger/SysLog.php, line 66
Class
- SysLog
- Redirects logging messages to syslog.
Namespace
Drupal\syslog\Logger
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | public function log( $level , $message , array $context = array ()) { global $base_url ; // Ensure we have a connection available. $this ->openConnection(); // Populate the message placeholders and then replace them in the message. $message_placeholders = $this ->parser->parseMessagePlaceholders( $message , $context ); $message = empty ( $message_placeholders ) ? $message : strtr ( $message , $message_placeholders ); $entry = strtr ( $this ->config->get( 'format' ), array ( '!base_url' => $base_url , '!timestamp' => $context [ 'timestamp' ], '!type' => $context [ 'channel' ], '!ip' => $context [ 'ip' ], '!request_uri' => $context [ 'request_uri' ], '!referer' => $context [ 'referer' ], '!uid' => $context [ 'uid' ], '!link' => strip_tags ( $context [ 'link' ]), '!message' => strip_tags ( $message ), )); syslog( $level , $entry ); } |
Please login to continue.