From 54f4e63a94c6efcc36881cba8802f86be3a5d290 Mon Sep 17 00:00:00 2001 From: linuxpoet Date: Thu, 15 Mar 2007 05:59:07 +0000 Subject: Modified to use STDERR if logging is turned on. Still to do, make actual logging different. Specifically allow logging to STDERR or a file. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@910 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/Log.pm | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/LedgerSMB/Log.pm b/LedgerSMB/Log.pm index a0bd80b4..0613132b 100644 --- a/LedgerSMB/Log.pm +++ b/LedgerSMB/Log.pm @@ -13,6 +13,7 @@ This module is loosly based on Apache::Log. Available methods: (in order, most to least severe) + =over 4 =item emerg @@ -53,28 +54,16 @@ use Carp (); our $VERSION = '1.0.0'; -our $fh; +our $log_line; sub print { if (!$LedgerSMB::Sysconfig::logging){ return 0; } shift; - unless($fh) { - # TODO: this is grosly wrong, but so is this module in the first place. - # the log messages *should* end up in the apache log, but that will - # hopefully be corrected in the future. - - $fh=IO::File->new('>>users/ledger-smb.log'); - $fh->autoflush(1); - __PACKAGE__->print('general',"Log file opened"); - } + $log_line = sprintf('[%s] [%s] %i %s', scalar(localtime), +shift, $$, join(' ',@_))."\n"; + print STDERR $log_line; - $fh->print(sprintf('[%s] [%s] %i %s', - scalar(localtime), - +shift, - $$, - join(' ',@_))."\n"); } -- cgit v1.2.3