diff options
author | Guillermo Ramos | 2019-06-25 12:57:22 +0200 |
---|---|---|
committer | Guillermo Ramos | 2019-06-25 13:03:53 +0200 |
commit | 077112d7242df2d1a26d90506b23045c6a6eb4ab (patch) | |
tree | 9509e135485c123a9f797347d0448e36eb46b84a /tgrecv | |
parent | 16cd42e6fbfbf6fff06fd50926ac374b771e3f97 (diff) | |
download | tgutils-077112d7242df2d1a26d90506b23045c6a6eb4ab.tar.gz |
TgLib::Cache does its own logging
Diffstat (limited to 'tgrecv')
-rwxr-xr-x | tgrecv | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -18,9 +18,9 @@ use JSON qw<encode_json>; use FindBin; use lib "$FindBin::Bin/lib"; use TgLib qw<fetch_token>; +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); |