From 077112d7242df2d1a26d90506b23045c6a6eb4ab Mon Sep 17 00:00:00 2001 From: Guillermo Ramos Date: Tue, 25 Jun 2019 12:57:22 +0200 Subject: TgLib::Cache does its own logging --- tgrecv | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'tgrecv') diff --git a/tgrecv b/tgrecv index 01b2d9e..4670b63 100755 --- a/tgrecv +++ b/tgrecv @@ -18,9 +18,9 @@ use JSON qw; use FindBin; use lib "$FindBin::Bin/lib"; use TgLib qw; +require TgLib::Api; require TgLib::Cache; require TgLib::Logger; -require TgLib::Api; my $TOKEN; my $OUTPUT; @@ -46,8 +46,7 @@ $TOKEN ||= fetch_token() or pod2usage(-message => "ERROR: Unable to get bot token ($!).\n", -verbose => 99, -sections => "AUTHENTICATION"); -my $cache = TgLib::Cache->new; -$logger->debug("Using cache: " . Dumper($cache)); +my $cache = TgLib::Cache->new($logger); # Get offset from cache if --auto-offset is enabled (and no --offset provided) if ($AUTO_OFFSET && ! $OFFSET) { @@ -63,11 +62,7 @@ if ($OUTPUT) { } # Store new offset in cache (last update id +1) -if ($AUTO_OFFSET && @$updates) { - $cache->offset($updates->[-1]{'update_id'}+1); - $logger->debug(sprintf "Cached offset %s (--auto-offset)\n", $cache->offset); - $cache->save; -} +$cache->offset($updates->[-1]{'update_id'}+1) if ($AUTO_OFFSET && @$updates); print $out encode_json($updates); -- cgit v1.2.3