diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-05-09 15:06:44 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-05-09 15:06:44 +0300 |
commit | d3a244f9d9f3a90b7bd92a22210601c7f543441f (patch) | |
tree | 414cd462f3aa50801f0e7be515e73add464237d5 /lib/public/Support | |
parent | 35b31110efce6799b1926c9485a246a1c60782dd (diff) |
Allow crash reporters to catpture any message
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/public/Support')
-rw-r--r-- | lib/public/Support/CrashReport/IMessageReporter.php | 43 | ||||
-rw-r--r-- | lib/public/Support/CrashReport/IRegistry.php | 24 |
2 files changed, 63 insertions, 4 deletions
diff --git a/lib/public/Support/CrashReport/IMessageReporter.php b/lib/public/Support/CrashReport/IMessageReporter.php new file mode 100644 index 00000000000..1085aa13df3 --- /dev/null +++ b/lib/public/Support/CrashReport/IMessageReporter.php @@ -0,0 +1,43 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace OCP\Support\CrashReport; + +/** + * @since 17.0.0 + */ +interface IMessageReporter extends IReporter { + + /** + * Report a (error) message + * + * @param string $message + * @param array $context + * + * @since 17.0.0 + */ + public function reportMessage(string $message, array $context = []): void; + +} diff --git a/lib/public/Support/CrashReport/IRegistry.php b/lib/public/Support/CrashReport/IRegistry.php index 2833e66a9b7..814b9c8e3b9 100644 --- a/lib/public/Support/CrashReport/IRegistry.php +++ b/lib/public/Support/CrashReport/IRegistry.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + /** * @author Christoph Wurst <christoph@winzerhof-wurst.at> * @@ -33,10 +35,11 @@ interface IRegistry { /** * Register a reporter instance * - * @since 13.0.0 * @param IReporter $reporter + * + * @since 13.0.0 */ - public function register(IReporter $reporter); + public function register(IReporter $reporter): void; /** * Delegate breadcrumb collection to all registered reporters @@ -47,14 +50,27 @@ interface IRegistry { * * @since 15.0.0 */ - public function delegateBreadcrumb(string $message, string $category, array $context = []); + public function delegateBreadcrumb(string $message, string $category, array $context = []): void; /** * Delegate crash reporting to all registered reporters * - * @since 13.0.0 * @param Exception|Throwable $exception * @param array $context + * + * @since 13.0.0 */ public function delegateReport($exception, array $context = []); + + /** + * Delegate a message to all reporters that implement IMessageReporter + * + * @param string $message + * @param array $context + * + * @return void + * + * @since 17.0.0 + */ + public function delegateMessage(string $message, array $context = []): void; } |