summaryrefslogtreecommitdiff
path: root/Echolot/Commands.pm
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2003-01-14 05:25:35 +0000
committerPeter Palfrader <peter@palfrader.org>2003-01-14 05:25:35 +0000
commitf46e990efedb3d5d8ef94e833e0fa676047da1fe (patch)
tree2482570e7e1c1b8458f3cf89163b87a30d1b1b70 /Echolot/Commands.pm
parente612f292dab8caad8f62cfef0ac40ae930d8efdf (diff)
First go at sane logging
Diffstat (limited to 'Echolot/Commands.pm')
-rw-r--r--Echolot/Commands.pm26
1 files changed, 13 insertions, 13 deletions
diff --git a/Echolot/Commands.pm b/Echolot/Commands.pm
index 5efdf2d..c370ec1 100644
--- a/Echolot/Commands.pm
+++ b/Echolot/Commands.pm
@@ -1,7 +1,7 @@
package Echolot::Commands;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Commands.pm,v 1.11 2002/09/11 03:10:27 weasel Exp $
+# $Id: Commands.pm,v 1.12 2003/01/14 05:25:34 weasel Exp $
#
=pod
@@ -17,7 +17,7 @@ This package provides functions for sending out and receiving pings.
=cut
use strict;
-use Carp qw{cluck};
+use Echolot::Log;
use Fcntl ':flock'; # import LOCK_* constants
#use Fcntl ':seek'; # import SEEK_* constants
use POSIX; # import SEEK_* constants (older perls don't have SEEK_ in Fcntl)
@@ -28,18 +28,18 @@ sub addCommand($) {
my $filename = Echolot::Config::get()->{'commands_file'};
open(FH, ">>$filename" ) or
- cluck("Cannot open $filename for appending $!"),
+ Echolot::Log::warn("Cannot open $filename for appending $!."),
return 0;
flock(FH, LOCK_EX) or
- cluck("Cannot get exclusive lock on $filename: $!"),
+ Echolot::Log::warn("Cannot get exclusive lock on $filename: $!."),
return 0;
print FH $command,"\n";
flock(FH, LOCK_UN) or
- cluck("Cannot unlock $filename: $!");
+ Echolot::Log::warn("Cannot unlock $filename: $!.");
close(FH) or
- cluck("Cannot close $filename: $!");
+ Echolot::Log::warn("Cannot close $filename: $!.");
};
sub processCommands($) {
@@ -52,10 +52,10 @@ sub processCommands($) {
return 1;
open(FH, "+<$filename" ) or
- cluck("Cannot open $filename for reading: $!"),
+ Echolot::Log::warn("Cannot open $filename for reading: $!."),
return 0;
flock(FH, LOCK_EX) or
- cluck("Cannot get exclusive lock on $filename: $!"),
+ Echolot::Log::warn("Cannot get exclusive lock on $filename: $!."),
return 0;
@@ -86,20 +86,20 @@ sub processCommands($) {
} elsif ($command eq 'deleteremailercaps') {
Echolot::Globals::get()->{'storage'}->delete_remailercaps(@args);
} else {
- warn("Unkown command: $_\n");
+ Echolot::Log::warn("Unkown command: '$_'.");
};
};
seek(FH, 0, SEEK_SET) or
- cluck("Cannot seek to start $filename $!"),
+ Echolot::Log::warn("Cannot seek to start '$filename': $!."),
return 0;
truncate(FH, 0) or
- cluck("Cannot truncate $filename to zero length: $!"),
+ Echolot::Log::warn("Cannot truncate '$filename' to zero length: $!."),
return 0;
flock(FH, LOCK_UN) or
- cluck("Cannot unlock $filename: $!");
+ Echolot::Log::warn("Cannot unlock '$filename': $!.");
close(FH) or
- cluck("Cannot close $filename: $!");
+ Echolot::Log::warn("Cannot close '$filename': $!.");
};
1;