Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This seems as if it should be simple, but I've been searching everywhere and can't find an answer.
I inherited a script that used MooseX::Log::Dispatch. It had a setup section that looked like:
I need to do some additional things with this, and no one seems to use this module, so I switched to doing it manually:has log_dispatch_conf => ( is => 'ro', isa => 'HashRef', lazy => 1, required => 1, default => sub { return { class => 'Log::Dispatch::File', min_level => 'debug', filename => $self->config->{mail_log_file}, mode => '>>', newline => 1, format => '[%d] [%p] %m at %F line %L%n', }; }, );
Unfortunately, it seems that Log::Dispatch itself doesn't use the format attribute. And I can't figure out how to apply this. I see there's a configurator module, but I don't want to create an entire configuration file, I just want to get this format into the output. Searching for things like "perl Log Dispatch format" isn't helping. How do I accomplish this?has 'logger' => ( is => 'ro', isa => 'Log::Dispatch', required => 1, lazy => 1, default => sub { return Log::Dispatch->new( outputs => [ [ 'File', min_level => 'debug', filename => $self->config->{mail_log_file}, mode => '>>', newline => 1, format => '[%d] [%p] %m at %F line %L%n', ], # ....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Format strings with Log::Dispatch?
by 1nickt (Canon) on Nov 12, 2019 at 17:52 UTC |