From 096e2b3e07084b90dc59e7efae289aefb710c54b Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Mon, 17 Feb 2014 20:27:13 +0100 Subject: [PATCH] Anonymise logs --- lib/Lutim.pm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/Lutim.pm b/lib/Lutim.pm index 0ec2abc..f36aecb 100644 --- a/lib/Lutim.pm +++ b/lib/Lutim.pm @@ -120,7 +120,7 @@ sub startup { $c->on(finish => sub { my $c = shift; $c->provisionning(); - $c->app->log->info('[HIT] '.$c->ip.' visited site index'); + $c->app->log->info('[HIT] someone visited site index'); } ); } @@ -176,7 +176,7 @@ sub startup { ); # Log image creation - $c->app->log->info('[CREATION] '.$ip.' pushed '.$filename.' (path: '.$path.')'); + $c->app->log->info('[CREATION] someone pushed '.$filename.' (path: '.$path.')'); # Give url to user $short = $records[0]->short; @@ -230,12 +230,11 @@ sub startup { my $dl = (defined($c->param('dl'))) ? 'attachment' : 'inline'; my @images = LutimModel::Lutim->select('WHERE short = ? AND ENABLED = 1 AND path IS NOT NULL', $short); - my $ip = $c->ip; if (scalar(@images)) { if($images[0]->delete_at_day && $images[0]->created_at + $images[0]->delete_at_day * 86400 <= time()) { # Log deletion - $c->app->log->info('[DELETION] '.$ip.' tried to view '.$images[0]->filename.' but it has been removed by expiration (path: '.$images[0]->path.')'); + $c->app->log->info('[DELETION] someone tried to view '.$images[0]->filename.' but it has been removed by expiration (path: '.$images[0]->path.')'); # Delete image unlink $images[0]->path(); @@ -265,19 +264,18 @@ sub startup { # Update counter and check provisionning $c->on(finish => sub { # Log access - $c->app->log->info('[VIEW] '.$ip.' viewed '.$images[0]->filename.' (path: '.$images[0]->path.')'); + $c->app->log->info('[VIEW] someone viewed '.$images[0]->filename.' (path: '.$images[0]->path.')'); # Update record my $counter = $images[0]->counter + 1; $images[0]->update(counter => $counter); $images[0]->update(last_access_at => time()); - $images[0]->update(last_access_by => $ip); # Delete image if needed if ($images[0]->delete_at_first_view) { # Log deletion - $c->app->log->info('[DELETION] '.$ip.' made '.$images[0]->filename.' removed (path: '.$images[0]->path.')'); + $c->app->log->info('[DELETION] someone made '.$images[0]->filename.' removed (path: '.$images[0]->path.')'); # Delete image unlink $images[0]->path(); @@ -292,7 +290,7 @@ sub startup { if (scalar(@images)) { # Log access try - $c->app->log->info('[NOT FOUND] '.$ip.' tried to view '.$short.' but it does\'nt exist.'); + $c->app->log->info('[NOT FOUND] someone tried to view '.$short.' but it does\'nt exist.'); # Warn user $c->flash(