« DRI/Protocol/EPP/Extensions/PL/Report.pm
↑ Summary
DRI/Protocol/EPP/Extensions/AFNIC/Notifications.pm »
| 1 | ## Domain Registry Interface, Logging operations for Net::DRI | ||||||||||||||||||||||||||||
| 2 | ## | ||||||||||||||||||||||||||||
| 3 | ## Copyright (c) 2009-2010,2012 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 4 | ## | ||||||||||||||||||||||||||||
| 5 | ## This file is part of Net::DRI | ||||||||||||||||||||||||||||
| 6 | ## | ||||||||||||||||||||||||||||
| 7 | ## Net::DRI is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 8 | ## it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 9 | ## the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 10 | ## (at your option) any later version. | ||||||||||||||||||||||||||||
| 11 | ## | ||||||||||||||||||||||||||||
| 12 | ## See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 13 | #################################################################################################### | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | package Net::DRI::Logging; | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 80 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 80 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 80 | ▶ | use base qw/Net::DRI::BaseClass/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 80 | ▶ | use Net::DRI::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 80 | ▶ | use Net::DRI::Exception; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 80 | __PACKAGE__->make_exception_if_not_implemented(qw/name setup_channel output/); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | ## Taken from Log::Log4Perl | ||||||||||||||||||||||||||||
| 27 | 80 | our %LEVELS=qw/debug 0 info 1 notice 2 warning 3 error 4 critical 5 alert 6 emergency 7/; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | #################################################################################################### | ||||||||||||||||||||||||||||
| 30 | ## Public API | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | sub new | ||||||||||||||||||||||||||||
| 33 | { | ||||||||||||||||||||||||||||
| 34 | 78 | ▶ | my $c=shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=16 SCAR=34.5
Pod
documented
| |||||||||||||||||||||||||||||
| 35 | 78 | ▶ | my $self=shift || {}; | ||||||||||||||||||||||||||
|
Condition50%1/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 36 | 78 | ▶ | if (! exists $self->{level} || ! defined $self->{level} ) { $self->{level} =3; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $self->{"level"} and defined $self->{"level"}
MC/DC0%0/2
exists $self->{"level"} and defined $self->{"level"}
exists $self->{"level"}
defined $self->{"level"}
Truth table33%1/3
A and B
A= exists $self->{"level"}B= defined $self->{"level"}
| |||||||||||||||||||||||||||||
| 37 | 78 | ▶ | if (! exists $self->{xml_indent} || ! defined $self->{xml_indent} ) { $self->{xml_indent} =0; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $self->{"xml_indent"} and defined $self->{"xml_indent"}
MC/DC0%0/2
exists $self->{"xml_indent"} and defined $self->{"xml_indent"}
exists $self->{"xml_indent"}
defined $self->{"xml_indent"}
Truth table33%1/3
A and B
A= exists $self->{"xml_indent"}B= defined $self->{"xml_indent"}
| |||||||||||||||||||||||||||||
| 38 | 78 | ▶ | if (! exists $self->{encoding} || ! defined $self->{encoding} ) { $self->{encoding} ='UTF-8'; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $self->{"encoding"} and defined $self->{"encoding"}
MC/DC0%0/2
exists $self->{"encoding"} and defined $self->{"encoding"}
exists $self->{"encoding"}
defined $self->{"encoding"}
Truth table33%1/3
A and B
A= exists $self->{"encoding"}B= defined $self->{"encoding"}
| |||||||||||||||||||||||||||||
| 39 | 78 | ▶ | if (! exists $self->{format_header} || ! defined $self->{format_header} ) { $self->{format_header} ='%FULLTIME [%ULEVEL] <%TYPE>'; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $self->{"format_header"} and defined $self->{"format_header"}
MC/DC0%0/2
exists $self->{"format_header"} and defined $self->{"format_header"}
exists $self->{"format_header"}
defined $self->{"format_header"}
Truth table33%1/3
A and B
A= exists $self->{"format_header"}B= defined $self->{"format_header"}
| |||||||||||||||||||||||||||||
| 40 | 78 | ▶ | if (! exists $self->{format_transport} || ! defined $self->{format_transport} ) { $self->{format_transport}='%TRID %UDIRECTION %MESSAGE'; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $self->{"format_transport"} and defined $self->{"format_transport"}
MC/DC0%0/2
exists $self->{"format_transport"} and defined $self->{"format_transport"}
exists $self->{"format_transport"}
defined $self->{"format_transport"}
Truth table33%1/3
A and B
A= exists $self->{"format_transport"}B= defined $self->{"format_transport"}
| |||||||||||||||||||||||||||||
| 41 | 78 | ▶ | if (! exists $self->{format_protocol} || ! defined $self->{format_protocol} ) { $self->{format_protocol} ='%TRID %UDIRECTION %MESSAGE'; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $self->{"format_protocol"} and defined $self->{"format_protocol"}
MC/DC0%0/2
exists $self->{"format_protocol"} and defined $self->{"format_protocol"}
exists $self->{"format_protocol"}
defined $self->{"format_protocol"}
Truth table33%1/3
A and B
A= exists $self->{"format_protocol"}B= defined $self->{"format_protocol"}
| |||||||||||||||||||||||||||||
| 42 | 78 | ▶ | if (! exists $self->{sanitize_data} || ! defined $self->{sanitize_data} ) { $self->{sanitize_data} = {}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $self->{"sanitize_data"} and defined $self->{"sanitize_data"}
MC/DC0%0/2
exists $self->{"sanitize_data"} and defined $self->{"sanitize_data"}
exists $self->{"sanitize_data"}
defined $self->{"sanitize_data"}
Truth table33%1/3
A and B
A= exists $self->{"sanitize_data"}B= defined $self->{"sanitize_data"}
| |||||||||||||||||||||||||||||
| 43 | 78 | bless $self,$c; | |||||||||||||||||||||||||||
| 44 | 78 | $self->level($self->{level}); ## convert the level token to a numerical value | |||||||||||||||||||||||||||
| 45 | 78 | return $self; | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | sub level | ||||||||||||||||||||||||||||
| 49 | { | ||||||||||||||||||||||||||||
| 50 | 78 | ▶ | my ($self,$level)=@_; | ||||||||||||||||||||||||||
|
Subroutine
level: called CC=5 SCAR=19.7
Pod
documented
| |||||||||||||||||||||||||||||
| 51 | 78 | ▶ | if (defined $level) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | { | ||||||||||||||||||||||||||||
| 53 | 78 | ▶ | if (exists $LEVELS{$level}) { $level=$LEVELS{$level}; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 78 | ▶ | if ($level!~/^\d+$/ || $level > 7) { $self->output('error','logging','Invalid level value "'.$level.'", switching to default'); $level=3; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $level =~ /^\d+$/ or $level > 7
MC/DC0%0/2
not $level =~ /^\d+$/ or $level > 7
not $level =~ /^\d+$/
$level > 7
Truth table33%1/3
not(A) or B
A= not $level =~ /^\d+$/B= $level > 7
| |||||||||||||||||||||||||||||
| 55 | 78 | $self->{level}=$level; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | 78 | return $self->{level}; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | #################################################################################################### | ||||||||||||||||||||||||||||
| 61 | ## Internal API | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | sub string_header | ||||||||||||||||||||||||||||
| 64 | { | ||||||||||||||||||||||||||||
| 65 | 0 | ▶ | my ($self,$level,$type,$data)=@_; | ||||||||||||||||||||||||||
|
Subroutine
string_header: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 66 | 0 | my $f=$self->{format_header}; | |||||||||||||||||||||||||||
| 67 | 0 | $f=~s/%FULLTIME/Net::DRI::Util::fulltime()/eg; | |||||||||||||||||||||||||||
| 68 | 0 | $f=~s/%ULEVEL/uc($level)/eg; | |||||||||||||||||||||||||||
| 69 | 0 | $f=~s/%TYPE/$type/g; | |||||||||||||||||||||||||||
| 70 | 0 | return $f; | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | sub string_data | ||||||||||||||||||||||||||||
| 74 | { | ||||||||||||||||||||||||||||
| 75 | 0 | ▶ | my ($self,$hdr,$type,$data)=@_; | ||||||||||||||||||||||||||
|
Subroutine
string_data: not called CC=15 SCAR=54.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 76 | 0 | ▶ | if (! ref $data || ! exists $self->{'format_'.$type}) { return $hdr.q{ }.$data; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $data and exists $$self{'format_' . $type}
MC/DC0%0/2
ref $data and exists $$self{'format_' . $type}
ref $data
exists $$self{'format_' . $type}
Truth table0%0/3
A and B
A= ref $dataB= exists $$self{'format_' . $type}
| |||||||||||||||||||||||||||||
| 77 | 0 | my $msg=$data->{message}; | |||||||||||||||||||||||||||
| 78 | 0 | my $ct=q{}; | |||||||||||||||||||||||||||
| 79 | 0 | my $ref=ref $msg; | |||||||||||||||||||||||||||
| 80 | 0 | ▶ | if ($ref) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | { | ||||||||||||||||||||||||||||
| 82 | 0 | ▶ | if ($ref eq 'Net::DRI::Data::Raw') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | { | ||||||||||||||||||||||||||||
| 84 | 0 | $ct=$msg->hint(); | |||||||||||||||||||||||||||
| 85 | } else | ||||||||||||||||||||||||||||
| 86 | { | ||||||||||||||||||||||||||||
| 87 | 0 | ▶ | if (! $msg->can('as_string')) { Net::DRI::Exception::method_not_implemented('as_string',ref $msg); } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | 0 | $msg=$msg->as_string($self->{sanitize_data}); | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | ## If this is deemed to be too brittle, a type() method could be added to Protocol/Message and correctly set to "xml" by Message classes in RRI,EPP,OpenSRS/XCP,IRIS/{XCP,LWZ} | ||||||||||||||||||||||||||||
| 93 | 0 | ▶ | if (! length($ct) && substr($msg,0,5) eq '<?xml') { $ct='xml'; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not length $ct and substr($msg, 0, 5) eq "<?xml"
MC/DC0%0/2
not length $ct and substr($msg, 0, 5) eq "<?xml"
not length $ct
substr($msg, 0, 5) eq "<?xml"
Truth table0%0/3
not(A) and B
A= not length $ctB= substr($msg, 0, 5) eq "<?xml"
| |||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 0 | ▶ | if ($ct eq 'xml') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 96 | { | ||||||||||||||||||||||||||||
| 97 | 0 | ▶ | if ($self->{xml_indent}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | { | ||||||||||||||||||||||||||||
| 99 | 0 | $msg=Net::DRI::Util::xml_indent($msg); | |||||||||||||||||||||||||||
| 100 | } else | ||||||||||||||||||||||||||||
| 101 | { | ||||||||||||||||||||||||||||
| 102 | 0 | $msg=~s/^\s+//mg; | |||||||||||||||||||||||||||
| 103 | 0 | $msg=~s/\s+$//mg; | |||||||||||||||||||||||||||
| 104 | 0 | $msg=~s/\n/ /g; | |||||||||||||||||||||||||||
| 105 | 0 | $msg=~s/> </></g; | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 0 | ▶ | $data->{all}=join q{ },map { $_.q{=}.(defined $data->{$_} ? $data->{$_} : '') } sort { $a cmp $b } keys %{$data}; ## this should be handy during debugging | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 0 | ▶ | if (exists $data->{direction}) { $data->{udirection}=uc $data->{direction}; $data->{adirection}=$data->{direction} eq 'in'? 'C<=S' : 'C=>S';} | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 111 | 0 | my @r; | |||||||||||||||||||||||||||
| 112 | 0 | foreach my $l (split /\n/,$msg) | |||||||||||||||||||||||||||
| 113 | { | ||||||||||||||||||||||||||||
| 114 | 0 | my $f=$hdr.q{ }.$self->{'format_'.$type}; | |||||||||||||||||||||||||||
| 115 | 0 | $data->{message}=$l; | |||||||||||||||||||||||||||
| 116 | 0 | ▶ | $f=~s/%([A-Z]+)/$data->{lc $1} || ''/eg; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | 0 | push @r,$f; | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | 0 | return join qq{\n}, @r; | |||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | sub tostring | ||||||||||||||||||||||||||||
| 123 | { | ||||||||||||||||||||||||||||
| 124 | 0 | ▶ | my ($self,$level,$type,$data)=@_; | ||||||||||||||||||||||||||
|
Subroutine
tostring: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 125 | 0 | my $hdr=$self->string_header($level,$type); | |||||||||||||||||||||||||||
| 126 | 0 | my $r=$self->string_data($hdr,$type,$data); | |||||||||||||||||||||||||||
| 127 | 0 | return Net::DRI::Util::encode($self->{encoding},$r); | |||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | sub should_log | ||||||||||||||||||||||||||||
| 131 | { | ||||||||||||||||||||||||||||
| 132 | 0 | ▶ | my ($self,$level)=@_; | ||||||||||||||||||||||||||
|
Subroutine
should_log: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 133 | 0 | ▶ | return ($LEVELS{$level} >= $self->{level})? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | #################################################################################################### | ||||||||||||||||||||||||||||
| 137 | 80 | 1; | |||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | __END__ | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | =pod | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | =head1 NAME | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | Net::DRI::Logging - Logging Operations for Net::DRI | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | This module is never used directly, only its subclasses are used. See the subclasses | ||||||||||||||||||||||||||||
| 150 | documentation: L<Net::DRI::Logging::Files>, L<Net::DRI::Logging::Null> and L<Net::DRI::Logging::Stderr>. | ||||||||||||||||||||||||||||
| 151 | See also L<Net::DRI> documentation and its C<logging()> method. | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | This is the superclass of all logging modules (under the L<Net::DRI::Logging::*> namespace). | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | =head1 EXAMPLES | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | See L<Net::DRI> documentation. | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | =head1 SUBROUTINES/METHODS | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | This is mostly a pure virtual superclass. All subclasses should have the following methods: | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | =over | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | =item new() | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | a ref hash is passed with some keys ; besides keys specifically related to the logging | ||||||||||||||||||||||||||||
| 170 | class used, some keys are (or should be) understood by all clases. | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | They are: | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | =over | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | =item level | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | current level of logging (no messages below this level would be dumped), between: | ||||||||||||||||||||||||||||
| 179 | debug info notice warning error critical alert emergency ; default: warning | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | It can be changed anytime later by using the level() method | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | =item xml_indent | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | 0 or 1 depending if you want your XML strings to be dumped as a long line (0) or indented for humans (1) ; default: 0 | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | =item encoding | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | if needed, name of encoding to use to convert data stream ; default: UTF-8 | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | =item sanitize_data | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | an optional ref hash to know which part of logged data should be replaced to ensure confidentiality; | ||||||||||||||||||||||||||||
| 194 | for now it works only for EPP, with the hash key "session_password" and a true value, then content | ||||||||||||||||||||||||||||
| 195 | of <pw> and <newPW> are replaced by a string of * in logging data | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | =back | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | =item name() | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | returns the name as string of the logging modules | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | =item setup_channel(SOURCE,TYPE,DATA) | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | prepare for a new channel of data comming from SOURCE (package name), of TYPE ; | ||||||||||||||||||||||||||||
| 206 | DATA is a ref hash of additional parameter, such as filenames, etc. | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | =item output(LEVEL,TYPE,DATA1,DATA2,...) | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | add data to channel type TYPE at level LEVEL ('debug', 'info', 'notice', etc.) ; | ||||||||||||||||||||||||||||
| 211 | DATA is a ref hash with all data to log or a simple string (the message) ; the logging module should know what | ||||||||||||||||||||||||||||
| 212 | to do with it and how to format it (which may depend on the TYPE attribute, which itself | ||||||||||||||||||||||||||||
| 213 | is tied to the SOURCE attribute of C<setup_channel()>). | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | =back | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | =head1 DIAGNOSTICS | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | None. | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | =head1 CONFIGURATION AND ENVIRONMENT | ||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | See the C<new()> method. | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | =head1 DEPENDENCIES | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | This module has to be used inside the Net::DRI framework and needs the following components: | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | =over | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | =item L<Net::DRI::BaseClass> | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | =item L<Net::DRI::Util> | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | =item L<Net::DRI::Exception> | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | =back | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | =head1 INCOMPATIBILITIES | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | None. | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | =head1 BUGS AND LIMITATIONS | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | No known bugs. Please report problems to author (see below) or use CPAN RT system. Patches are welcome. | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | The interface could be later changed to suit Log::Log4Perl or other Perl standard logging modules, if needed. | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | Other subclasses should be created to cater for other logging destinations (such as a RDBMS). | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | L<Net::DRI> expects these logging modules to be non-blocking and returning immediately. | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | This logging framework is currently only used by L<Net::DRI::Transport::Socket>, it should | ||||||||||||||||||||||||||||
| 254 | get applied to other transports and other internal parts of L<Net::DRI>. | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | When LocalStorage do appear inside Net::DRI, logging should probably use it (TODO). | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | For now, support questions should be sent to: | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | Please also see the SUPPORT file in the distribution. | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | Patrick Mevzek, E<lt>netdri@dotandco.comE<gt> | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | Copyright (c) 2009-2010,2012 Patrick Mevzek <netdri@dotandco.com>. All rights reserved. | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 279 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 280 | the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||
| 281 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | See the LICENSE file that comes with this distribution for more details. | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | =cut | ||||||||||||||||||||||||||||