From 88deb85b5a6564b05af783110a5af6ba3dbb0cf2 Mon Sep 17 00:00:00 2001 From: Kenichi Ishigaki Date: Sat, 18 May 2024 18:33:47 +0900 Subject: [PATCH] Log messages via $c->app->pause->log --- lib/pause_2017/PAUSE/Web/Controller/Public.pm | 5 +++-- lib/pause_2017/PAUSE/Web/Controller/Public/RequestId.pm | 4 +++- lib/pause_2017/PAUSE/Web/Controller/User/Distperms.pm | 5 +++-- lib/pause_2017/PAUSE/Web/Controller/User/Perms.pm | 5 +++-- lib/pause_2017/PAUSE/Web/Plugin/WrapAction.pm | 3 ++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/pause_2017/PAUSE/Web/Controller/Public.pm b/lib/pause_2017/PAUSE/Web/Controller/Public.pm index a9815d132..46ae90bb2 100644 --- a/lib/pause_2017/PAUSE/Web/Controller/Public.pm +++ b/lib/pause_2017/PAUSE/Web/Controller/Public.pm @@ -80,8 +80,9 @@ sub mailpw { # we have. unless ($email = $rec->{secretemail}) { my $u = $c->active_user_record($param,{hidden_user_ok => 1}); - require YAML::Syck; print STDERR "Line " . __LINE__ . ", File: " . __FILE__ . "\n" . YAML::Syck::Dump({u=>$u}); # XXX - + require YAML::Syck; + my $message = "Line " . __LINE__ . ", File: " . __FILE__ . "\n" . YAML::Syck::Dump({u=>$u}); + $mgr->log({level => 'debug', message => $message}); $email = $u->{email}; } if ($email) { diff --git a/lib/pause_2017/PAUSE/Web/Controller/Public/RequestId.pm b/lib/pause_2017/PAUSE/Web/Controller/Public/RequestId.pm index f1058ba7e..5ea014ceb 100644 --- a/lib/pause_2017/PAUSE/Web/Controller/Public/RequestId.pm +++ b/lib/pause_2017/PAUSE/Web/Controller/Public/RequestId.pm @@ -163,7 +163,9 @@ sub request { userid => $userid, rationale => $rationale, }; - require Data::Dumper; print STDERR "Line " . __LINE__ . ", File: " . __FILE__ . "\n" . Data::Dumper->new([$session->{APPLY}],[qw(APPLY)])->Indent(1)->Useqq(1)->Dump; # XXX + require Data::Dumper; + my $message = "Line " . __LINE__ . ", File: " . __FILE__ . "\n" . Data::Dumper->new([$session->{APPLY}],[qw(APPLY)])->Indent(1)->Useqq(1)->Dump; + $c->app->pause->log({level => 'debug', message => $message }); if (lc($fullname) eq lc($userid)) { die PAUSE::Web::Exception->new(ERROR => "fullname looks like spam"); } diff --git a/lib/pause_2017/PAUSE/Web/Controller/User/Distperms.pm b/lib/pause_2017/PAUSE/Web/Controller/User/Distperms.pm index 3bf77859d..fcc96716c 100644 --- a/lib/pause_2017/PAUSE/Web/Controller/User/Distperms.pm +++ b/lib/pause_2017/PAUSE/Web/Controller/User/Distperms.pm @@ -183,8 +183,9 @@ sub remove_dist_primary { if (0) { # here I discovered that Apache::Request has case-insensitive keys my %p = map { $_, [ $req->every_param($_)] } @{$req->param->names}; - require Data::Dumper; print STDERR "Line " . __LINE__ . ", File: " . __FILE__ . "\n" . Data::Dumper->new([\%p],[qw()])->Indent(1)->Useqq(1)->Dump; # XXX - + require Data::Dumper; + my $message = "Line " . __LINE__ . ", File: " . __FILE__ . "\n" . Data::Dumper->new([\%p],[qw()])->Indent(1)->Useqq(1)->Dump; + $c->app->pause->log({level => 'debug', message => $message}); } if ( diff --git a/lib/pause_2017/PAUSE/Web/Controller/User/Perms.pm b/lib/pause_2017/PAUSE/Web/Controller/User/Perms.pm index 9c3db8926..43972fa6d 100644 --- a/lib/pause_2017/PAUSE/Web/Controller/User/Perms.pm +++ b/lib/pause_2017/PAUSE/Web/Controller/User/Perms.pm @@ -283,8 +283,9 @@ sub _share_remopr { if (0) { # here I discovered that Apache::Request has case-insensitive keys my %p = map { $_, [ $req->every_param($_)] } @{$req->param->names}; - require Data::Dumper; print STDERR "Line " . __LINE__ . ", File: " . __FILE__ . "\n" . Data::Dumper->new([\%p],[qw()])->Indent(1)->Useqq(1)->Dump; # XXX - + require Data::Dumper; + my $message = "Line " . __LINE__ . ", File: " . __FILE__ . "\n" . Data::Dumper->new([\%p],[qw()])->Indent(1)->Useqq(1)->Dump; + $c->app->pause->log({level => 'debug', message => $message}); } if ( diff --git a/lib/pause_2017/PAUSE/Web/Plugin/WrapAction.pm b/lib/pause_2017/PAUSE/Web/Plugin/WrapAction.pm index bfb82240a..80e13b8e1 100644 --- a/lib/pause_2017/PAUSE/Web/Plugin/WrapAction.pm +++ b/lib/pause_2017/PAUSE/Web/Plugin/WrapAction.pm @@ -25,7 +25,8 @@ sub _wrap { $@->{ERROR} = [ $@->{ERROR} ] unless ref $@->{ERROR} eq 'ARRAY'; push @{$pause->{ERROR}}, @{$@->{ERROR}}; require Data::Dumper; - print STDERR "Line " . __LINE__ . ", File: " . __FILE__ . "\n" . Data::Dumper->new([$pause->{ERROR}],[qw(error)])->Indent(1)->Useqq(1)->Dump; # XXX + my $message = "Line " . __LINE__ . ", File: " . __FILE__ . "\n" . Data::Dumper->new([$pause->{ERROR}],[qw(error)])->Indent(1)->Useqq(1)->Dump; + $c->app->pause->log({level => 'debug', message => $message}); $c->res->code($@->{HTTP_STATUS}) if $@->{HTTP_STATUS}; $c->render('layouts/layout') unless $c->stash('Action'); } elsif ($@->{HTTP_STATUS}) {