diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2021-03-05 16:51:55 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2021-03-05 16:51:55 +0300 |
commit | 5ec2323f252ad8df25414e6386ab8000f7e3c9cc (patch) | |
tree | 27337dcdfb32df0be2248e8f34a1c35e519722b6 /apps/admin_audit | |
parent | c7c5150ddbd00efd9946d00fac673661e5e33a89 (diff) |
Move admin_audit to LoggerInterface
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/admin_audit')
-rw-r--r-- | apps/admin_audit/lib/Actions/Action.php | 9 | ||||
-rw-r--r-- | apps/admin_audit/lib/AppInfo/Application.php | 34 |
2 files changed, 20 insertions, 23 deletions
diff --git a/apps/admin_audit/lib/Actions/Action.php b/apps/admin_audit/lib/Actions/Action.php index f081957a067..28e3281988d 100644 --- a/apps/admin_audit/lib/Actions/Action.php +++ b/apps/admin_audit/lib/Actions/Action.php @@ -29,16 +29,13 @@ declare(strict_types=1); namespace OCA\AdminAudit\Actions; -use OCP\ILogger; +use Psr\Log\LoggerInterface; class Action { - /** @var ILogger */ + /** @var LoggerInterface */ private $logger; - /** - * @param ILogger $logger - */ - public function __construct(ILogger $logger) { + public function __construct(LoggerInterface $logger) { $this->logger = $logger; } diff --git a/apps/admin_audit/lib/AppInfo/Application.php b/apps/admin_audit/lib/AppInfo/Application.php index 13c031ff0ba..3e67085e3ba 100644 --- a/apps/admin_audit/lib/AppInfo/Application.php +++ b/apps/admin_audit/lib/AppInfo/Application.php @@ -58,19 +58,19 @@ use OCP\Authentication\TwoFactorAuth\IProvider; use OCP\Console\ConsoleEvent; use OCP\IConfig; use OCP\IGroupManager; -use OCP\ILogger; use OCP\IPreview; use OCP\IServerContainer; use OCP\IUserSession; use OCP\Log\ILogFactory; use OCP\Share; use OCP\Util; +use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; class Application extends App implements IBootstrap { - /** @var ILogger */ + /** @var LoggerInterface */ protected $logger; public function __construct() { @@ -81,7 +81,7 @@ class Application extends App implements IBootstrap { } public function boot(IBootContext $context): void { - /** @var ILogger $logger */ + /** @var LoggerInterface $logger */ $logger = $context->injectFn( Closure::fromCallable([$this, 'getLogger']) ); @@ -94,21 +94,21 @@ class Application extends App implements IBootstrap { } private function getLogger(IConfig $config, - ILogger $logger, - ILogFactory $logFactory): ILogger { + LoggerInterface $logger, + ILogFactory $logFactory): LoggerInterface { $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log'; $logFile = $config->getAppValue('admin_audit', 'logfile', $default); if ($logFile === null) { return $logger; } - return $logFactory->getCustomLogger($logFile); + return $logFactory->getCustomPsrLogger($logFile); } /** * Register hooks in order to log them */ - private function registerHooks(ILogger $logger, + private function registerHooks(LoggerInterface $logger, IServerContainer $serverContainer) { $this->userManagementHooks($logger, $serverContainer->get(IUserSession::class)); $this->groupHooks($logger, $serverContainer->get(IGroupManager::class)); @@ -128,7 +128,7 @@ class Application extends App implements IBootstrap { $this->securityHooks($logger, $eventDispatcher); } - private function userManagementHooks(ILogger $logger, + private function userManagementHooks(LoggerInterface $logger, IUserSession $userSession) { $userActions = new UserManagement($logger); @@ -142,7 +142,7 @@ class Application extends App implements IBootstrap { $userSession->listen('\OC\User', 'postUnassignedUserId', [$userActions, 'unassign']); } - private function groupHooks(ILogger $logger, + private function groupHooks(LoggerInterface $logger, IGroupManager $groupManager) { $groupActions = new GroupManagement($logger); @@ -153,7 +153,7 @@ class Application extends App implements IBootstrap { $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); } - private function sharingHooks(ILogger $logger) { + private function sharingHooks(LoggerInterface $logger) { $shareActions = new Sharing($logger); Util::connectHook(Share::class, 'post_shared', $shareActions, 'shared'); @@ -165,7 +165,7 @@ class Application extends App implements IBootstrap { Util::connectHook(Share::class, 'share_link_access', $shareActions, 'shareAccessed'); } - private function authHooks(ILogger $logger) { + private function authHooks(LoggerInterface $logger) { $authActions = new Auth($logger); Util::connectHook('OC_User', 'pre_login', $authActions, 'loginAttempt'); @@ -173,7 +173,7 @@ class Application extends App implements IBootstrap { Util::connectHook('OC_User', 'logout', $authActions, 'logout'); } - private function appHooks(ILogger $logger, + private function appHooks(LoggerInterface $logger, EventDispatcherInterface $eventDispatcher) { $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function (ManagerEvent $event) use ($logger) { $appActions = new AppManagement($logger); @@ -189,7 +189,7 @@ class Application extends App implements IBootstrap { }); } - private function consoleHooks(ILogger $logger, + private function consoleHooks(LoggerInterface $logger, EventDispatcherInterface $eventDispatcher) { $eventDispatcher->addListener(ConsoleEvent::EVENT_RUN, function (ConsoleEvent $event) use ($logger) { $appActions = new Console($logger); @@ -197,7 +197,7 @@ class Application extends App implements IBootstrap { }); } - private function fileHooks(ILogger $logger, + private function fileHooks(LoggerInterface $logger, EventDispatcherInterface $eventDispatcher) { $fileActions = new Files($logger); $eventDispatcher->addListener( @@ -259,19 +259,19 @@ class Application extends App implements IBootstrap { ); } - private function versionsHooks(ILogger $logger) { + private function versionsHooks(LoggerInterface $logger) { $versionsActions = new Versions($logger); Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); Util::connectHook('\OCP\Versions', 'delete', $versionsActions, 'delete'); } - private function trashbinHooks(ILogger $logger) { + private function trashbinHooks(LoggerInterface $logger) { $trashActions = new Trashbin($logger); Util::connectHook('\OCP\Trashbin', 'preDelete', $trashActions, 'delete'); Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', $trashActions, 'restore'); } - private function securityHooks(ILogger $logger, + private function securityHooks(LoggerInterface $logger, EventDispatcherInterface $eventDispatcher) { $eventDispatcher->addListener(IProvider::EVENT_SUCCESS, function (GenericEvent $event) use ($logger) { $security = new Security($logger); |