diff options
author | linuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-03-15 05:59:07 +0000 |
---|---|---|
committer | linuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-03-15 05:59:07 +0000 |
commit | 54f4e63a94c6efcc36881cba8802f86be3a5d290 (patch) | |
tree | 7a1652f7773fd7b3c31ebb4a7827f9061c5d4935 | |
parent | 2fadcc214a0ec531954ab61a3ce016845d754243 (diff) |
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
-rw-r--r-- | LedgerSMB/Log.pm | 19 |
1 files 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"); } |