summaryrefslogtreecommitdiffstats
path: root/lib/private/AppFramework/Http
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2022-02-02 09:57:50 +0100
committerJulius Härtl <jus@bitgrid.net>2022-02-28 11:24:40 +0100
commit0f33453610c46ef730192820017f8c1270b3096f (patch)
treecbdab0cd21d4c1f812196586be5d9599dcf387ae /lib/private/AppFramework/Http
parent19f68b3011a3c040899fb84975a28bd746bddb4b (diff)
downloadnextcloud-server-0f33453610c46ef730192820017f8c1270b3096f.tar.gz
nextcloud-server-0f33453610c46ef730192820017f8c1270b3096f.zip
Diagnostics event logging to Nextcloud log
Signed-off-by: Julius Härtl <jus@bitgrid.net> Add config samples Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/AppFramework/Http')
-rw-r--r--lib/private/AppFramework/Http/Dispatcher.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/private/AppFramework/Http/Dispatcher.php b/lib/private/AppFramework/Http/Dispatcher.php
index 0f12dbda629..21d61bc95aa 100644
--- a/lib/private/AppFramework/Http/Dispatcher.php
+++ b/lib/private/AppFramework/Http/Dispatcher.php
@@ -39,6 +39,7 @@ use OC\DB\ConnectionAdapter;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\Response;
+use OCP\Diagnostics\IEventLogger;
use OCP\IConfig;
use OCP\IRequest;
use Psr\Log\LoggerInterface;
@@ -69,6 +70,9 @@ class Dispatcher {
/** @var LoggerInterface */
private $logger;
+ /** @var IEventLogger */
+ private $eventLogger;
+
/**
* @param Http $protocol the http protocol with contains all status headers
* @param MiddlewareDispatcher $middlewareDispatcher the dispatcher which
@@ -79,6 +83,7 @@ class Dispatcher {
* @param IConfig $config
* @param ConnectionAdapter $connection
* @param LoggerInterface $logger
+ * @param IEventLogger $eventLogger
*/
public function __construct(Http $protocol,
MiddlewareDispatcher $middlewareDispatcher,
@@ -86,7 +91,8 @@ class Dispatcher {
IRequest $request,
IConfig $config,
ConnectionAdapter $connection,
- LoggerInterface $logger) {
+ LoggerInterface $logger,
+ IEventLogger $eventLogger) {
$this->protocol = $protocol;
$this->middlewareDispatcher = $middlewareDispatcher;
$this->reflector = $reflector;
@@ -94,6 +100,7 @@ class Dispatcher {
$this->config = $config;
$this->connection = $connection;
$this->logger = $logger;
+ $this->eventLogger = $eventLogger;
}
@@ -214,7 +221,9 @@ class Dispatcher {
$arguments[] = $value;
}
+ $this->eventLogger->start('controller:' . get_class($controller) . '::' . $methodName, 'App framework controller execution');
$response = \call_user_func_array([$controller, $methodName], $arguments);
+ $this->eventLogger->end('controller:' . get_class($controller) . '::' . $methodName);
// format response
if ($response instanceof DataResponse || !($response instanceof Response)) {