Browse Source

loggin' like a lumberjack

master
Jonathan "Duke" Leto 7 years ago
parent
commit
19f9e7029f
  1. 1
      lib/Hush/List.pm
  2. 21
      lib/Hush/Logger.pm

1
lib/Hush/List.pm

@ -4,7 +4,6 @@ use warnings;
use Hush::RPC;
use Try::Tiny;
use File::Spec::Functions;
use Carp qw/longmess/;
use Hush::Util qw/barf/;
use File::Slurp;

21
lib/Hush/Logger.pm

@ -0,0 +1,21 @@
package Hush::Logger;
use strict;
use warnings;
use Try::Tiny;
use File::Spec::Functions;
use Exporter 'import';
our @EXPORT_OK = qw/debug/;
my $HUSH_CONFIG_DIR = $ENV{HUSH_CONFIG_DIR} || catdir($ENV{HOME},'.hush');
my $HUSHLIST_CONFIG_DIR = $ENV{HUSH_CONFIG_DIR} || catdir($HUSH_CONFIG_DIR, 'list');
sub debug {
my ($msg) = @_;
my $time = localtime();
my $debug = catfile($HUSHLIST_CONFIG_DIR, 'debug.log');
open(my $log, '>>', $debug) or barf("Could not open $debug for writing!!!");
print $log "[$time] [$$] $msg";
close $log;
}
1;
Loading…
Cancel
Save