eaiovnaovbqoebvqoeavibavo usr/share/perl5/vendor_perl/Log/Dispatch/Screen.pm000064400000004065147635375120016104 0ustar00package Log::Dispatch::Screen; { $Log::Dispatch::Screen::VERSION = '2.41'; } use strict; use warnings; use Log::Dispatch::Output; use base qw( Log::Dispatch::Output ); use Params::Validate qw(validate BOOLEAN); Params::Validate::validation_options( allow_extra => 1 ); sub new { my $proto = shift; my $class = ref $proto || $proto; my %p = validate( @_, { stderr => { type => BOOLEAN, default => 1 }, } ); my $self = bless {}, $class; $self->_basic_init(%p); $self->{stderr} = exists $p{stderr} ? $p{stderr} : 1; return $self; } sub log_message { my $self = shift; my %p = @_; if ( $self->{stderr} ) { print STDERR $p{message}; } else { print STDOUT $p{message}; } } 1; # ABSTRACT: Object for logging to the screen __END__ =pod =head1 NAME Log::Dispatch::Screen - Object for logging to the screen =head1 VERSION version 2.41 =head1 SYNOPSIS use Log::Dispatch; my $log = Log::Dispatch->new( outputs => [ [ 'Screen', min_level => 'debug', stderr => 1, newline => 1 ] ], ); $log->alert("I'm searching the city for sci-fi wasabi"); =head1 DESCRIPTION This module provides an object for logging to the screen (really STDOUT or STDERR). Note that a newline will I be added automatically at the end of a message by default. To do that, pass C 1>. =head1 CONSTRUCTOR The constructor takes the following parameters in addition to the standard parameters documented in L: =over 4 =item * stderr (0 or 1) Indicates whether or not logging information should go to STDERR. If false, logging information is printed to STDOUT instead. This defaults to true. =back =head1 AUTHOR Dave Rolsky =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2013 by Dave Rolsky. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) =cut usr/share/perl5/vendor_perl/Log/Log4perl/Appender/Screen.pm000064400000006151147635723440017573 0ustar00################################################## package Log::Log4perl::Appender::Screen; ################################################## our @ISA = qw(Log::Log4perl::Appender); use warnings; use strict; ################################################## sub new { ################################################## my($class, @options) = @_; my $self = { name => "unknown name", stderr => 1, utf8 => undef, @options, }; if( $self->{utf8} ) { if( $self->{stderr} ) { binmode STDERR, ":utf8"; } else { binmode STDOUT, ":utf8"; } } bless $self, $class; } ################################################## sub log { ################################################## my($self, %params) = @_; if($self->{stderr}) { print STDERR $params{message}; } else { print $params{message}; } } 1; __END__ =encoding utf8 =head1 NAME Log::Log4perl::Appender::Screen - Log to STDOUT/STDERR =head1 SYNOPSIS use Log::Log4perl::Appender::Screen; my $app = Log::Log4perl::Appender::Screen->new( stderr => 0, utf8 => 1, ); $file->log(message => "Log me\n"); =head1 DESCRIPTION This is a simple appender for writing to STDOUT or STDERR. The constructor C take an optional parameter C, if set to a true value, the appender will log to STDERR. The default setting for C is 1, so messages will be logged to STDERR by default. If C is set to a false value, it will log to STDOUT (or, more accurately, whichever file handle is selected via C, STDOUT by default). Design and implementation of this module has been greatly inspired by Dave Rolsky's C appender framework. To enable printing wide utf8 characters, set the utf8 option to a true value: my $app = Log::Log4perl::Appender::Screen->new( stderr => 1, utf8 => 1, ); This will issue the necessary binmode command to the selected output channel (stderr/stdout). =head1 LICENSE Copyright 2002-2013 by Mike Schilli Em@perlmeister.comE and Kevin Goess Ecpan@goess.orgE. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHOR Please contribute patches to the project on Github: http://github.com/mschilli/log4perl Send bug reports or requests for enhancements to the authors via our MAILING LIST (questions, bug reports, suggestions/patches): log4perl-devel@lists.sourceforge.net Authors (please contact them via the list above, not directly): Mike Schilli , Kevin Goess Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars Thegler, David Viner, Mac Yang.