summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/diagnostics/ievent.php36
-rw-r--r--lib/public/diagnostics/ieventlogger.php39
-rw-r--r--lib/public/diagnostics/iquery.php26
-rw-r--r--lib/public/diagnostics/iquerylogger.php27
-rw-r--r--lib/public/iservercontainer.php16
5 files changed, 144 insertions, 0 deletions
diff --git a/lib/public/diagnostics/ievent.php b/lib/public/diagnostics/ievent.php
new file mode 100644
index 00000000000..a2a3461f68a
--- /dev/null
+++ b/lib/public/diagnostics/ievent.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCP\Diagnostics;
+
+interface IEvent {
+ /**
+ * @return string
+ */
+ public function getId();
+
+ /**
+ * @return string
+ */
+ public function getDescription();
+
+ /**
+ * @return float
+ */
+ public function getStart();
+
+ /**
+ * @return float
+ */
+ public function getEnd();
+
+ /**
+ * @return float
+ */
+ public function getDuration();
+}
diff --git a/lib/public/diagnostics/ieventlogger.php b/lib/public/diagnostics/ieventlogger.php
new file mode 100644
index 00000000000..cd9f2768ca3
--- /dev/null
+++ b/lib/public/diagnostics/ieventlogger.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCP\Diagnostics;
+
+interface IEventLogger {
+ /**
+ * Mark the start of an event
+ *
+ * @param string $id
+ * @param string $description
+ */
+ public function start($id, $description);
+
+ /**
+ * Mark the end of an event
+ *
+ * @param string $id
+ */
+ public function end($id);
+
+ /**
+ * @param string $id
+ * @param string $description
+ * @param float $start
+ * @param float $end
+ */
+ public function log($id, $description, $start, $end);
+
+ /**
+ * @return \OCP\Diagnostics\IEvent[]
+ */
+ public function getEvents();
+}
diff --git a/lib/public/diagnostics/iquery.php b/lib/public/diagnostics/iquery.php
new file mode 100644
index 00000000000..f1111e069bb
--- /dev/null
+++ b/lib/public/diagnostics/iquery.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCP\Diagnostics;
+
+interface IQuery {
+ /**
+ * @return string
+ */
+ public function getSql();
+
+ /**
+ * @return array
+ */
+ public function getParams();
+
+ /**
+ * @return float
+ */
+ public function getDuration();
+}
diff --git a/lib/public/diagnostics/iquerylogger.php b/lib/public/diagnostics/iquerylogger.php
new file mode 100644
index 00000000000..0fba9eb8b10
--- /dev/null
+++ b/lib/public/diagnostics/iquerylogger.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OCP\Diagnostics;
+
+use Doctrine\DBAL\Logging\SQLLogger;
+
+interface IQueryLogger extends SQLLogger {
+ /**
+ * @param string $sql
+ * @param array $params
+ * @param array $types
+ */
+ public function startQuery($sql, array $params = null, array $types = null);
+
+ public function stopQuery();
+
+ /**
+ * @return \OCP\Diagnostics\IQuery[]
+ */
+ public function getQueries();
+}
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
index a093ff3a640..55c2c89b710 100644
--- a/lib/public/iservercontainer.php
+++ b/lib/public/iservercontainer.php
@@ -248,4 +248,20 @@ interface IServerContainer {
* @return \OC\HTTPHelper
*/
function getHTTPHelper();
+
+ /**
+ * Get the active event logger
+ *
+ * @return \OCP\Diagnostics\IEventLogger
+ */
+ function getEventLogger();
+
+ /**
+ * Get the active query logger
+ *
+ * The returned logger only logs data when debug mode is enabled
+ *
+ * @return \OCP\Diagnostics\IQueryLogger
+ */
+ function getQueryLogger();
}