Add help, debug log, fix pid file creation
+ Add help in group chat + Add debug log ability * A bit of cleanup * Check against start uid rather than effective uid when creating pid-file
This commit is contained in:
@@ -11,12 +11,12 @@ use JSON::XS qw(decode_json encode_json);
|
||||
use Digest::MD5 qw(md5_base64);
|
||||
use DB_File;
|
||||
|
||||
use conf;
|
||||
use conf qw(loadConf);
|
||||
|
||||
use vars qw/$VERSION/;
|
||||
|
||||
use Exporter qw(import);
|
||||
our @EXPORT = qw(weather);
|
||||
our @EXPORT = qw(weather logger);
|
||||
|
||||
$VERSION = "1.0";
|
||||
|
||||
@@ -188,6 +188,19 @@ sub __urlencode($) {
|
||||
return $str;
|
||||
}
|
||||
|
||||
sub logger {
|
||||
my $msg = shift;
|
||||
|
||||
if ($c->{debug_log}) {
|
||||
my $mode = '>';
|
||||
$mode = '>>' if (-f $c->{debug_log});
|
||||
|
||||
if (open (LOG, $mode, $c->{debug_log})) {
|
||||
print LOG $msg . "\n";
|
||||
close LOG;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user