From 6ab47030face35fb044c75bda1d92f4c320a088d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Sun, 1 Mar 2009 10:56:00 +0000
Subject: [PATCH] Capture LDAP logs on ldap status page..

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1345 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/ldapstatus/templates/ldapsinglehost.php | 5 ++++-
 modules/ldapstatus/www/index.php                | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/modules/ldapstatus/templates/ldapsinglehost.php b/modules/ldapstatus/templates/ldapsinglehost.php
index 4c9a3dde0..b3a11b850 100644
--- a/modules/ldapstatus/templates/ldapsinglehost.php
+++ b/modules/ldapstatus/templates/ldapsinglehost.php
@@ -150,7 +150,10 @@ if ($ok) {
 
 
 
-
+<h2>Debug log</h2>
+<pre style="background: #eee; border: 1px solid #aaa">
+<?php echo join("\n", $this->data['debugLog']); ?>
+</pre>
 
 
 <?php $this->includeAtTemplateBase('includes/footer.php'); ?>
\ No newline at end of file
diff --git a/modules/ldapstatus/www/index.php b/modules/ldapstatus/www/index.php
index 9caa4444e..97d0f7547 100644
--- a/modules/ldapstatus/www/index.php
+++ b/modules/ldapstatus/www/index.php
@@ -112,6 +112,8 @@ if (array_key_exists('orgtest', $_REQUEST)) {
 	$locindex = 0;
 	if (array_key_exists('locindex', $_REQUEST)) $locindex = $_REQUEST['locindex'];
 	
+	SimpleSAML_Logger::setCaptureLog();
+	
 	$orgconfig = SimpleSAML_Configuration::loadFromArray($orgs[$_REQUEST['orgtest']], 'org:[' . $_REQUEST['orgtest'] . ']');
 	$orgloc = $orgs[$_REQUEST['orgtest']]['locations'][$locindex];
 	$orgloc = mergeWithTemplate($orgloc, $locationTemplate);
@@ -126,6 +128,7 @@ if (array_key_exists('orgtest', $_REQUEST)) {
 	
 	$t->data['res'] = $res;
 	$t->data['org'] = $orgs[$_REQUEST['orgtest']];
+	$t->data['debugLog'] = SimpleSAML_Logger::getCapturedLog();
 	if ($isAdmin) $t->data['secretURL'] = $secretURL;
 	$t->show();
 	exit;
-- 
GitLab