From c3339067efb81e46e992ab1e9855edd4bcb912a5 Mon Sep 17 00:00:00 2001
From: Nigel Kukard <nkukard@lbsd.net>
Date: Fri, 28 Jan 2011 07:47:16 +0000
Subject: [PATCH] Fixed up timer display

Display timers only if we have log level greater than NOTICE (so we display for LOG_INFO)

Fixed incorret calculation, we forgot a timer to add into the mix
---
 smradiusd | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/smradiusd b/smradiusd
index db63402d..f1d3aa58 100755
--- a/smradiusd
+++ b/smradiusd
@@ -1068,8 +1068,15 @@ CHECK_RESULT:
 	my $timer9 = [gettimeofday];
 	my $timediff1 = tv_interval($timer0,$timer1);
 	my $timediff2 = tv_interval($timer1,$timer2);
+	my $timediff3 = tv_interval($timer2,$timer9);
 	my $timediff = tv_interval($timer0,$timer9);
-	$self->log(LOG_NOTICE,"[SMRADIUS] Result: $logReason (%.3fs + %.3fs = %.3fs) => $logLine",$timediff1,$timediff2,$timediff);
+
+	# How should we output this ...
+	if ($server->{'log_level'} > LOG_NOTICE) {
+		$self->log(LOG_NOTICE,"[SMRADIUS] Result: $logReason (%.3fs + %.3fs + %.3fs = %.3fs) => $logLine",$timediff1,$timediff2,$timediff3,$timediff);
+	} else {
+		$self->log(LOG_NOTICE,"[SMRADIUS] Result: $logReason");
+	}
 
 	# If we using abuse prevention record the time we ending off
 	if ($self->{'smradius'}->{'use_abuse_prevention'} && defined($user->{'Username'})) {
-- 
GitLab