« blib/lib/Lemonldap/NG/Common/OpenIDConnect/Constants.pm
↑ Summary
blib/lib/Lemonldap/NG/Common/AuditLogger/UserLoggerCompat.pm »
| 1 | package Lemonldap::NG::Common::AuditLogger::UserLoggerJSON; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use JSON; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Scalar::Util qw(weaken); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | our $VERSION = '2.21.0'; | |||||||||
| 8 | |||||||||||
| 9 | 2 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 10 | 2 | my ( $class, $psgi_or_handler ) = @_; | |||||||||
| 11 | 2 | my $self = bless {}, $class; | |||||||||
| 12 | |||||||||||
| 13 | 2 | ▶ | $self->{userLogger} = $psgi_or_handler->userLogger | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | or die 'Missing userLogger'; | ||||||||||
| 15 | 2 | weaken $self->{userLogger}; | |||||||||
| 16 | 2 | my $json = JSON->new->canonical; | |||||||||
| 17 | 2 | ▶ | $self->{encode} = sub { $json->encode(@_) }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 2 | return $self; | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 4 | ▶ | sub log { | ||||||||
|
Subroutine
log: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 22 | 4 | my ( $self, $req, %fields ) = @_; | |||||||||
| 23 | |||||||||||
| 24 | 4 | my $message = $fields{message}; | |||||||||
| 25 | 4 | foreach ( keys %fields ) { | |||||||||
| 26 | 6 | ▶ | delete $fields{$_} if ref( $fields{$_} ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | } | ||||||||||
| 28 | 4 | $fields{remote_addr} = $req->address; | |||||||||
| 29 | 4 | $self->{userLogger}->notice( $self->{encode}->( \%fields ) ); | |||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 1 | 1; | |||||||||