summaryrefslogtreecommitdiff
path: root/Echolot/Thesaurus.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/Thesaurus.pm
parente612f292dab8caad8f62cfef0ac40ae930d8efdf (diff)
First go at sane logging
Diffstat (limited to 'Echolot/Thesaurus.pm')
-rw-r--r--Echolot/Thesaurus.pm17
1 files changed, 8 insertions, 9 deletions
diff --git a/Echolot/Thesaurus.pm b/Echolot/Thesaurus.pm
index b32dd80..afce0d9 100644
--- a/Echolot/Thesaurus.pm
+++ b/Echolot/Thesaurus.pm
@@ -1,7 +1,7 @@
package Echolot::Thesaurus;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Thesaurus.pm,v 1.13 2002/12/03 02:59:13 weasel Exp $
+# $Id: Thesaurus.pm,v 1.14 2003/01/14 05:25:35 weasel Exp $
#
=pod
@@ -17,8 +17,8 @@ This package provides necessary functions for the thesaurus.
=cut
use strict;
-use Carp qw{cluck};
use English;
+use Echolot::Log;
sub save_thesaurus($$$) {
@@ -27,13 +27,13 @@ sub save_thesaurus($$$) {
return 1 unless Echolot::Config::get()->{'thesaurus'};
my ($type) = $otype =~ /^([a-z-]+)$/;
- cluck("type '$otype' is not clean in save_thesaurus"), return 0 unless defined $type;
+ Echolot::Log::cluck("type '$otype' is not clean in save_thesaurus."), return 0 unless defined $type;
my ($id) = $oid =~ /^([0-9]+)$/;
- cluck("id '$oid' is not clean in save_thesaurus"), return 0 unless defined $id;
+ Echolot::Log::cluck("id '$oid' is not clean in save_thesaurus."), return 0 unless defined $id;
my $file = Echolot::Config::get()->{'thesaurusdir'}.'/'.$id.'.'.$type;
open (F, ">$file") or
- cluck ("Cannot open '$file': $!"),
+ Echolot::Log::warn ("Cannot open '$file': $!."),
return 0;
print F $data;
close (F);
@@ -46,7 +46,7 @@ sub build_thesaurus() {
my $dir = Echolot::Config::get()->{'thesaurusdir'};
opendir(DIR, $dir) or
- cluck ("Cannot open '$dir': $!"),
+ Echolot::Log::warn ("Cannot open '$dir': $!."),
return 0;
my @files = grep { ! /^\./ } readdir(DIR);
closedir(DIR);
@@ -69,9 +69,8 @@ sub build_thesaurus() {
if ($mtime < $expire_date) {
unlink ($dir.'/'.$filename) or
- cluck("Cannot unlink expired $filename");
- print ("Expired thesaurus file $filename\n") if
- Echolot::Config::get()->{'verbose'};
+ Echolot::Log::warn("Cannot unlink expired $filename.");
+ Echolot::Log::info("Expired thesaurus file $filename.");
next;
};