From: Ian Jackson Subject: [OSSTEST PATCH 2/3] TestSupport: logm: allow $logm_handle to be an aref Date: Fri, 21 Feb 2014 13:37:30 +0000 Message-ID: <1392989851-26051-3-git-send-email-ian.jackson@eu.citrix.com> References: <1392989851-26051-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WGqIT-00070a-Ej for xen-devel@lists.xenproject.org; Fri, 21 Feb 2014 13:37:45 +0000 In-Reply-To: <1392989851-26051-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org If $logm_handle is an array reference, iterate over it. This allows calling code to duplicate the messages. Signed-off-by: Ian Jackson --- Osstest/TestSupport.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 31748b1..b2f0b22 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -175,11 +175,14 @@ sub ts_get_host_guest { # pass this @ARGV sub logm ($) { my ($m) = @_; my @t = gmtime; - printf $logm_handle "%04d-%02d-%02d %02d:%02d:%02d Z %s\n", - $t[5]+1900,$t[4]+1,$t[3], $t[2],$t[1],$t[0], - $m - or die $!; - $logm_handle->flush or die $!; + my $fm = sprintf "%04d-%02d-%02d %02d:%02d:%02d Z %s\n", + $t[5]+1900,$t[4]+1,$t[3], $t[2],$t[1],$t[0], + $m; + foreach my $h ((ref($logm_handle) eq 'ARRAY') + ? @$logm_handle : $logm_handle) { + print $h $fm or die $!; + $h->flush or die $!; + } } sub fail ($) { -- 1.7.10.4