| 1 | use strict; | ||
| 2 | use warnings; | ||
| 3 | |||
| 4 | package App::Embra::App; | ||
| 5 | $App::Embra::App::VERSION = '0.001'; # TRIAL | ||
| 6 | # ABSTRACT: App::Embra's App::Cmd | ||
| 7 | |||
| 8 | use App::Cmd::Setup -app; | ||
| 9 | |||
| 10 | use Log::Any::Adapter; | ||
| 11 | use Log::Any::Adapter::Dispatch; | ||
| 12 | |||
| 13 | sub global_opt_spec { | ||
| 14 | return ( | ||
| 15 | [ 'debug|g', 'show debug messages' ], | ||
| 16 | ); | ||
| 17 | } | ||
| 18 | |||
| 19 | sub prepare_command { | ||
| 20 | my $self = shift; | ||
| 21 | my @res = $self->SUPER::prepare_command( @_ ); | ||
| 22 | my $min_level = 'info'; | ||
| 23 | if ( $self->global_options->debug ) { | ||
| 24 | $min_level = 'debug'; | ||
| 25 | } | ||
| 26 | Log::Any::Adapter->set( 'Dispatch', | ||
| 27 | outputs => [ | ||
| 28 | [ 'Screen', min_level => $min_level, newline => 1 ], | ||
| 29 | ], | ||
| 30 | ); | ||
| 31 | return @res; | ||
| 32 | } | ||
| 33 | |||
| 34 | 1; | ||
| 35 | |||
| 36 | __END__ |