blob: 8e77afaf207a03cb3a862b7844089a8699917d1c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<?php
/**
* ownCloud
*
* @author Vincent Petry
* @copyright 2014 Vincent Petry <pvince81@owncloud.com>
*
* @license AGPL3
*/
class OC_Connector_Sabre_ExceptionLoggerPlugin extends Sabre_DAV_ServerPlugin
{
private $appName;
/**
* @param string $loggerAppName app name to use when logging
*/
public function __construct($loggerAppName = 'webdav') {
$this->appName = $loggerAppName;
}
/**
* This initializes the plugin.
*
* This function is called by Sabre_DAV_Server, after
* addPlugin is called.
*
* This method should set up the required event subscriptions.
*
* @param Sabre_DAV_Server $server
* @return void
*/
public function initialize(Sabre_DAV_Server $server) {
$server->subscribeEvent('exception', array($this, 'logException'), 10);
}
/**
* Log exception
*
* @internal param Exception $e exception
*/
public function logException($e) {
$exceptionClass = get_class($e);
if ($exceptionClass !== 'Sabre_DAV_Exception_NotAuthenticated') {
\OCP\Util::logException($this->appName, $e);
}
}
}
|