From 7a3ab22439a6ba47b58523b7df146a6b6957bdce Mon Sep 17 00:00:00 2001 From: Axel Beckert Date: Mon, 17 May 2010 02:09:47 +0200 Subject: [PATCH] Split helper functions logprint into logprint and logonly --- bin/xen-create-image | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/bin/xen-create-image b/bin/xen-create-image index ecc62f8..8786b42 100755 --- a/bin/xen-create-image +++ b/bin/xen-create-image @@ -3617,6 +3617,28 @@ sub setupRootPassword +=begin doc + + Print the given string to the logfile. + +=end doc + +=cut + +sub logonly +{ + my ($text) = (@_); + + if ( $CONFIG{ 'hostname' } ) + { + open( LOGFILE, ">>", "/var/log/xen-tools/$CONFIG{'hostname'}.log" ) or + return; + print LOGFILE $text; + close(LOGFILE); + } +} + + =begin doc Print the given string both to our screen, and to the logfile. @@ -3630,17 +3652,7 @@ sub logprint my ($text) = (@_); print $text; - - # - # Log. - # - if ( $CONFIG{ 'hostname' } ) - { - open( LOGFILE, ">>", "/var/log/xen-tools/$CONFIG{'hostname'}.log" ) or - return; - print LOGFILE $text; - close(LOGFILE); - } + logonly($text); }