@@ -59,7 +59,9 @@ public function read(BeforeNodeReadEvent $event): void {
5959 'path ' => mb_substr ($ event ->getNode ()->getInternalPath (), 5 ),
6060 ];
6161 } catch (InvalidPathException |NotFoundException $ e ) {
62- $ this ->error ("Exception thrown in file read: " .$ e ->getMessage ());
62+ \OCP \Server::get (LoggerInterface::class)->error (
63+ "Exception thrown in file read: " .$ e ->getMessage (), ['app ' => 'admin_audit ' ]
64+ );
6365 return ;
6466 }
6567 $ this ->log (
@@ -84,7 +86,9 @@ public function rename(NodeRenamedEvent $event): void {
8486 'newpath ' => mb_substr ($ target ->getPath (), 5 ),
8587 ];
8688 } catch (InvalidPathException |NotFoundException $ e ) {
87- $ this ->error ("Exception thrown in file rename: " .$ e ->getMessage ());
89+ \OCP \Server::get (LoggerInterface::class)->error (
90+ "Exception thrown in file rename: " .$ e ->getMessage (), ['app ' => 'admin_audit ' ]
91+ );
8892 return ;
8993 }
9094
@@ -107,7 +111,9 @@ public function create(NodeCreatedEvent $event): void {
107111 'path ' => mb_substr ($ event ->getNode ()->getInternalPath (), 5 ),
108112 ];
109113 } catch (InvalidPathException |NotFoundException $ e ) {
110- $ this ->error ("Exception thrown in file create: " .$ e ->getMessage ());
114+ \OCP \Server::get (LoggerInterface::class)->error (
115+ "Exception thrown in file create: " .$ e ->getMessage (), ['app ' => 'admin_audit ' ]
116+ );
111117 return ;
112118 }
113119 if ($ params ['path ' ] === '/ ' || $ params ['path ' ] === '' ) {
@@ -134,7 +140,9 @@ public function copy(NodeCopiedEvent $event): void {
134140 'newpath ' => mb_substr ($ event ->getTarget ()->getInternalPath (), 5 ),
135141 ];
136142 } catch (InvalidPathException |NotFoundException $ e ) {
137- $ this ->error ("Exception thrown in file copy: " .$ e ->getMessage ());
143+ \OCP \Server::get (LoggerInterface::class)->error (
144+ "Exception thrown in file copy: " .$ e ->getMessage (), ['app ' => 'admin_audit ' ]
145+ );
138146 return ;
139147 }
140148 $ this ->log (
@@ -156,7 +164,9 @@ public function write(BeforeNodeWrittenEvent $event): void {
156164 'path ' => mb_substr ($ event ->getNode ()->getInternalPath (), 5 ),
157165 ];
158166 } catch (InvalidPathException |NotFoundException $ e ) {
159- $ this ->error ("Exception thrown in file write: " .$ e ->getMessage ());
167+ \OCP \Server::get (LoggerInterface::class)->error (
168+ "Exception thrown in file write: " .$ e ->getMessage (), ['app ' => 'admin_audit ' ]
169+ );
160170 return ;
161171 }
162172 if ($ params ['path ' ] === '/ ' || $ params ['path ' ] === '' ) {
@@ -182,7 +192,9 @@ public function update(NodeWrittenEvent $event): void {
182192 'path ' => mb_substr ($ event ->getNode ()->getInternalPath (), 5 ),
183193 ];
184194 } catch (InvalidPathException |NotFoundException $ e ) {
185- $ this ->error ("Exception thrown in file update: " .$ e ->getMessage ());
195+ \OCP \Server::get (LoggerInterface::class)->error (
196+ "Exception thrown in file update: " .$ e ->getMessage (), ['app ' => 'admin_audit ' ]
197+ );
186198 return ;
187199 }
188200 $ this ->log (
@@ -204,7 +216,9 @@ public function delete(NodeDeletedEvent $event): void {
204216 'path ' => mb_substr ($ event ->getNode ()->getInternalPath (), 5 ),
205217 ];
206218 } catch (InvalidPathException |NotFoundException $ e ) {
207- $ this ->error ("Exception thrown in file delete: " .$ e ->getMessage ());
219+ \OCP \Server::get (LoggerInterface::class)->error (
220+ "Exception thrown in file delete: " .$ e ->getMessage (), ['app ' => 'admin_audit ' ]
221+ );
208222 return ;
209223 }
210224 $ this ->log (
@@ -231,7 +245,9 @@ public function preview(BeforePreviewFetchedEvent $event): void {
231245 'path ' => mb_substr ($ file ->getInternalPath (), 5 )
232246 ];
233247 } catch (InvalidPathException |NotFoundException $ e ) {
234- $ this ->error ("Exception thrown in file preview: " .$ e ->getMessage ());
248+ \OCP \Server::get (LoggerInterface::class)->error (
249+ "Exception thrown in file preview: " .$ e ->getMessage (), ['app ' => 'admin_audit ' ]
250+ );
235251 return ;
236252 }
237253 $ this ->log (
@@ -240,14 +256,4 @@ public function preview(BeforePreviewFetchedEvent $event): void {
240256 array_keys ($ params )
241257 );
242258 }
243-
244- /**
245- * @throws ContainerExceptionInterface
246- * @throws NotFoundExceptionInterface
247- */
248- public function error (string $ message ): void {
249- \OCP \Server::get (LoggerInterface::class)->error (
250- $ message , ['app ' => 'admin_audit ' ]
251- );
252- }
253259}
0 commit comments