| 1 | package XAS::Lib::Modules::Log::Console; | ||
| 2 | |||
| 3 | 1 | our $VERSION = '0.01'; | |
| 4 | |||
| 5 | 1 | ▶ | use Params::Validate 'HASHREF'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | use XAS::Class | ||
| 7 | 1 | version => $VERSION, | |
| 8 | base => 'XAS::Base', | ||
| 9 | mixins => 'init_log output destroy', | ||
| 10 | 1 | ▶ | ; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | # ---------------------------------------------------------------------- | ||
| 13 | # Public Methods | ||
| 14 | # ---------------------------------------------------------------------- | ||
| 15 | |||
| 16 | sub output { | ||
| 17 | 0 | ▶ | my $self = shift; |
|
Subroutine
output: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 18 | 0 | my ($args) = $self->validate_params(\@_, [ | |
| 19 | { type => HASHREF } | ||
| 20 | ]); | ||
| 21 | |||
| 22 | warn sprintf("%-5s - %s\n", | ||
| 23 | uc($args->{priority}), | ||
| 24 | $args->{message} | ||
| 25 | 0 | ); | |
| 26 | |||
| 27 | } | ||
| 28 | |||
| 29 | sub destroy { | ||
| 30 | 0 | ▶ | my $self = shift; |
|
Subroutine
destroy: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 31 | |||
| 32 | } | ||
| 33 | |||
| 34 | # ---------------------------------------------------------------------- | ||
| 35 | # Private Methods | ||
| 36 | # ---------------------------------------------------------------------- | ||
| 37 | |||
| 38 | sub init_log { | ||
| 39 | 0 | ▶ | my $self = shift; |
|
Subroutine
init_log: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 40 | 0 | return $self; | |
| 41 | } | ||
| 42 | |||
| 43 | 1 | 1; | |
| 44 | |||
| 45 | __END__ | ||
| 46 | |||
| 47 | =head1 NAME | ||
| 48 | |||
| 49 | XAS::Lib::Modules::Log::Console - A mixin class for logging | ||
| 50 | |||
| 51 | =head1 DESCRIPTION | ||
| 52 | |||
| 53 | This module is a mixin for logging. It logs to stderr. | ||
| 54 | |||
| 55 | =head1 METHODS | ||
| 56 | |||
| 57 | =head2 init_log | ||
| 58 | |||
| 59 | This method initializes the module. | ||
| 60 | |||
| 61 | =head2 output($hashref) | ||
| 62 | |||
| 63 | The method formats the hashref and writes out the results. | ||
| 64 | |||
| 65 | =head2 destroy | ||
| 66 | |||
| 67 | This methods deinitializes the module. | ||
| 68 | |||
| 69 | =head1 SEE ALSO | ||
| 70 | |||
| 71 | =over 4 | ||
| 72 | |||
| 73 | =item L<XAS::Lib::Modules::Log|XAS::Lib::Modules::Log> | ||
| 74 | |||
| 75 | =item L<XAS|XAS> | ||
| 76 | |||
| 77 | =back | ||
| 78 | |||
| 79 | =head1 AUTHOR | ||
| 80 | |||
| 81 | Kevin L. Esteb, E<lt>kevin@kesteb.usE<gt> | ||
| 82 | |||
| 83 | =head1 COPYRIGHT AND LICENSE | ||
| 84 | |||
| 85 | Copyright (C) 2014 Kevin L. Esteb | ||
| 86 | |||
| 87 | This is free software; you can redistribute it and/or modify it under | ||
| 88 | the terms of the Artistic License 2.0. For details, see the full text | ||
| 89 | of the license at http://www.perlfoundation.org/artistic_license_2_0. | ||
| 90 | |||
| 91 | =cut | ||