Skip to content

Commit

Permalink
Add logging example implementation to groupwareserver (#1505)
Browse files Browse the repository at this point in the history
Co-authored-by: Yannik Sembritzki <yannik.sembritzki@gmail.com>
  • Loading branch information
DeepDiver1975 and Yannik committed Nov 9, 2023
1 parent 66862ce commit 3d64b70
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions examples/groupwareserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
$carddavBackend = new \Sabre\CardDAV\Backend\PDO($pdo);
$caldavBackend = new \Sabre\CalDAV\Backend\PDO($pdo);

/**
* PSR-3 Logging facility.
*/
$logger = new \Monolog\Logger('SabreDav');
$logger->pushHandler(new \Monolog\Handler\RotatingFileHandler(__DIR__.'/sabredav.log', 3, \Monolog\Logger::DEBUG, true, 0600));

/**
* The directory tree.
*
Expand All @@ -70,6 +76,10 @@
$server->setBaseUri($baseUri);
}

// Logging
$server->setLogger($logger);
//$server->debugExceptions = true; //enable this to include the stacktrace in exception responses

// Plugins
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend));
$server->addPlugin(new \Sabre\DAV\Browser\Plugin());
Expand Down

0 comments on commit 3d64b70

Please sign in to comment.