comparison core/lib/Drupal/Core/Logger/LoggerChannel.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents c75dbcec494b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
99 99
100 // Merge in defaults. 100 // Merge in defaults.
101 $context += [ 101 $context += [
102 'channel' => $this->channel, 102 'channel' => $this->channel,
103 'link' => '', 103 'link' => '',
104 'user' => NULL,
105 'uid' => 0, 104 'uid' => 0,
106 'request_uri' => '', 105 'request_uri' => '',
107 'referer' => '', 106 'referer' => '',
108 'ip' => '', 107 'ip' => '',
109 'timestamp' => time(), 108 'timestamp' => time(),
111 // Some context values are only available when in a request context. 110 // Some context values are only available when in a request context.
112 if ($this->requestStack && $request = $this->requestStack->getCurrentRequest()) { 111 if ($this->requestStack && $request = $this->requestStack->getCurrentRequest()) {
113 $context['request_uri'] = $request->getUri(); 112 $context['request_uri'] = $request->getUri();
114 $context['referer'] = $request->headers->get('Referer', ''); 113 $context['referer'] = $request->headers->get('Referer', '');
115 $context['ip'] = $request->getClientIP(); 114 $context['ip'] = $request->getClientIP();
116 try { 115
117 if ($this->currentUser) { 116 if ($this->currentUser) {
118 $context['user'] = $this->currentUser; 117 $context['uid'] = $this->currentUser->id();
119 $context['uid'] = $this->currentUser->id();
120 }
121 }
122 catch (\Exception $e) {
123 // An exception might be thrown if the database connection is not
124 // available or due to another unexpected reason. It is more important
125 // to log the error that we already have so any additional exceptions
126 // are ignored.
127 } 118 }
128 } 119 }
129 120
130 if (is_string($level)) { 121 if (is_string($level)) {
131 // Convert to integer equivalent for consistency with RFC 5424. 122 // Convert to integer equivalent for consistency with RFC 5424.