Skip to content

Instantly share code, notes, and snippets.

@bradjones1
Last active January 30, 2016 00:21
Show Gist options
  • Save bradjones1/f8c16d640ca8d1f2d559 to your computer and use it in GitHub Desktop.
Save bradjones1/f8c16d640ca8d1f2d559 to your computer and use it in GitHub Desktop.
Log simplesamlphp error info to syslog, for cross-reference to trackID
<?php
/**
* Class error_show
*
* A custom error show method to log some useful additional information.
*/
class error_show {
public static function show($config, $data) {
$additional = $data['error'] + ['cookie-headers' => $_COOKIE];
unset($additional['exceptionMsg']);
unset($additional['exceptionTrace']);
$debug = new SimpleSAML_Logger_LoggingHandlerSyslog;
$debug->setArray($additional);
$debug->setLogFormat('json');
$debug->log(SimpleSAML_Logger::NOTICE, '');
$t = new SimpleSAML_XHTML_Template($config, 'error.php', 'errors');
$t->data = array_merge($t->data, $data);
$t->show();
exit;
}
}
@bradjones1
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment