From 5a991a9ad1a82f89469f08bae6f8ac67e10f642d Mon Sep 17 00:00:00 2001
From: Nigel Kukard <nkukard@lbsd.net>
Date: Tue, 11 Jan 2011 10:29:32 +0000
Subject: [PATCH] Added sprintf support in logging

If ->log is given additional arguments, the $msg will be used as
a format, and all additional arguments will be used as parameters
to sprintf()
---
 smradiusd | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/smradiusd b/smradiusd
index 8a33e559..32ea1d19 100755
--- a/smradiusd
+++ b/smradiusd
@@ -1076,7 +1076,11 @@ sub log
 		$msg = "[CORE] $logtxt: $msg";
 	}
 
-	$self->SUPER::log($level,"[".$self->log_time." - $$] $msg",@args);
+	# If we have args, this is more than likely a format string & args
+	if (@args > 0) {
+		$msg = sprintf($msg,@args);
+	}
+	$self->SUPER::log($level,"[".$self->log_time." - $$] $msg");
 }
 
 
-- 
GitLab