Class::Usul::TraitFor::OutputLogging - Localised logging and command line output methods
use Moo; extends 'Class::Usul'; with 'Class::Usul::TraitFor::OutputLogging';
Localised logging and command line output methods
Requires the following;
config
log
Defines the following command line options;
L locale
Print text and error messages in the selected language. If no language catalogue is supplied prints text and errors in terse English. Defaults to en
en
q quiet_flag
Quietens the usual started/finished information messages
$leader = $self->add_leader( $text, $opts );
Prepend $self->config->name to each line of $text. If $opts->{no_lead} exists then do nothing. Return $text with leader prepended
$self->config->name
$text
$opts->{no_lead}
$self->error( $text, $opts );
Calls Class::Usul::localize with the passed options. Logs the result at the error level, then adds the program leader and prints the result to STDERR
$self->fatal( $text, $opts );
Calls Class::Usul::localize with the passed options. Logs the result at the alert level, then adds the program leader and prints the result to STDERR. Exits with a return code of one
$self->info( $text, $opts );
Calls Class::Usul::localize with the passed options. Logs the result at the info level, then adds the program leader and prints the result to STDOUT
$localized_text = $self->loc( $message, @options );
Localises the message. Calls localizer. The domains to search are in the l10n_domains configuration attribute. Adds $self->locale to the arguments passed to localizer
l10n_domains
$self->locale
localizer
$self->output( $text, $opts );
Calls Class::Usul::localize with the passed options. Adds the program leader and prints the result to STDOUT
$bool = $self->quiet( $bool );
Custom accessor/mutator for the quiet_flag attribute. Will throw if you try to turn quiet mode off
quiet_flag
$self->warning( $text, $opts );
Calls Class::Usul::localize with the passed options. Logs the result at the warning level, then adds the program leader and prints the result to STDOUT
None
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to http://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-Usul. Patches are welcome
Larry Wall - For the Perl programming language
Peter Flanigan, <pjfl@cpan.org>
<pjfl@cpan.org>
Copyright (c) 2016 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
To install Class::Usul, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::Usul
CPAN shell
perl -MCPAN -e shell install Class::Usul
For more information on module installation, please visit the detailed CPAN module installation guide.