Created
February 15, 2013 07:20
-
-
Save yappo/4958963 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Log::Dispatch::Screen::Color::Emotional; | |
use strict; | |
use warnings; | |
use parent 'Log::Dispatch::Screen::Color'; | |
our $EMOTION = { | |
debug => '(☼ Д ☼)', | |
info => 'm9(^Д^)', | |
warn => '(´・ω・`)', | |
critical => '(; Д ) ゜ ゜', | |
}; | |
sub new { | |
my $proto = shift; | |
my $self = $proto->SUPER::new(@_); | |
# inject callbacks | |
$self->add_callback(sub { | |
my(%params) = @_; | |
join ' ', $EMOTION->{$params{level}}, $params{message}; | |
} ); | |
$self; | |
} | |
my $log = Log::Dispatch::Screen::Color::Emotional->new( | |
name => '椅子', | |
min_level => 'debug', | |
stderr => 1, | |
); | |
$log->log( level => 'debug', message => "psで見たときの視認性悪い\n" ); | |
$log->log( level => 'info', message => "java嫌いjava嫌いjava嫌いjava嫌いjava嫌いjava嫌いjava嫌い\n" ); | |
$log->log( level => 'warn', message => "そのDevOpsの先に待っているのは形だけのNoOpsでしかないし、Site Reliabilityは霧となって消え失せる\n" ); | |
$log->log( level => 'critical', message => "くそさーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーびすーーーーーーーーーーーーーーーーーーーーー\n" ); | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment