Server IP : 103.119.228.120 / Your IP : 18.119.125.240 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/share/perl5/vendor_perl/Log/Message/ |
Upload File : |
package Log::Message::Handlers; use if $] > 5.017, 'deprecate'; use strict; use vars qw[$VERSION]; $VERSION = '0.08'; =pod =head1 NAME Log::Message::Handlers - Message handlers for Log::Message =head1 SYNOPSIS # Implicitly used by Log::Message to serve as handlers for # Log::Message::Item objects # Create your own file with a package called # Log::Message::Handlers to add to the existing ones, or to even # overwrite them $item->carp; $item->trace; =head1 DESCRIPTION Log::Message::Handlers provides handlers for Log::Message::Item objects. The handler corresponding to the level (see Log::Message::Item manpage for an explanation about levels) will be called automatically upon storing the error. Handlers may also explicitly be called on an Log::Message::Item object if one so desires (see the Log::Message manpage on how to retrieve the Item objects). =head1 Default Handlers =head2 log Will simply log the error on the stack, and do nothing special =cut sub log { 1 } =head2 carp Will carp (see the Carp manpage) with the error, and add the timestamp of when it occurred. =cut sub carp { my $self = shift; warn join " ", $self->message, $self->shortmess, 'at', $self->when, "\n"; } =head2 croak Will croak (see the Carp manpage) with the error, and add the timestamp of when it occurred. =cut sub croak { my $self = shift; die join " ", $self->message, $self->shortmess, 'at', $self->when, "\n"; } =head2 cluck Will cluck (see the Carp manpage) with the error, and add the timestamp of when it occurred. =cut sub cluck { my $self = shift; warn join " ", $self->message, $self->longmess, 'at', $self->when, "\n"; } =head2 confess Will confess (see the Carp manpage) with the error, and add the timestamp of when it occurred =cut sub confess { my $self = shift; die join " ", $self->message, $self->longmess, 'at', $self->when, "\n"; } =head2 die Will simply die with the error message of the item =cut sub die { die shift->message; } =head2 warn Will simply warn with the error message of the item =cut sub warn { warn shift->message; } =head2 trace Will provide a traceback of this error item back to the first one that occurred, clucking with every item as it comes across it. =cut sub trace { my $self = shift; for my $item( $self->parent->retrieve( chrono => 0 ) ) { $item->cluck; } } =head1 Custom Handlers If you wish to provide your own handlers, you can simply do the following: =over 4 =item * Create a file that holds a package by the name of C<Log::Message::Handlers> =item * Create subroutines with the same name as the levels you wish to handle in the Log::Message module (see the Log::Message manpage for explanation on levels) =item * Require that file in your program, or add it in your configuration (see the Log::Message::Config manpage for explanation on how to use a config file) =back And that is it, the handler will now be available to handle messages for you. The arguments a handler may receive are those specified by the C<extra> key, when storing the message. See the Log::Message manpage for details on the arguments. =head1 SEE ALSO L<Log::Message>, L<Log::Message::Item>, L<Log::Message::Config> =head1 AUTHOR This module by Jos Boumans E<lt>kane@cpan.orgE<gt>. =head1 Acknowledgements Thanks to Ann Barcomb for her suggestions. =head1 COPYRIGHT This module is copyright (c) 2002 Jos Boumans E<lt>kane@cpan.orgE<gt>. All rights reserved. This library is free software; you may redistribute and/or modify it under the same terms as Perl itself. =cut 1; # Local variables: # c-indentation-style: bsd # c-basic-offset: 4 # indent-tabs-mode: nil # End: # vim: expandtab shiftwidth=4: