A logging role building a very lightweight wrapper to Log::Log4perl for use with your Moose or Moo classes. The initialization of the Log4perl instance must be performed prior to logging the first log message. Otherwise the default initialization will happen, probably not doing the things you expect.
For compatibility the 'logger' attribute can be accessed to use a common interface for application logging.
Using the logger within a class is as simple as consuming a role:
package MyClass; use Moose; with 'MooseX::Log::Log4perl'; sub dummy { my $self = shift; $self->log->info("Dummy log entry"); }
The logger needs to be setup before using the logger, which could happen in the main application:
package main; use Log::Log4perl qw(:easy); use MyClass; BEGIN { Log::Log4perl->easy_init() }; my $myclass = MyClass->new(); $myclass->log->info("In my class"); # Access the log of the object $myclass->dummy; # Will log "Dummy log entry"
Package Version | Update ID | Released | Package Hub Version | Platforms | Subpackages |
---|---|---|---|---|---|
0.47-bp156.3.1 info | GA Release | 2023-07-22 | 15 SP6 |
|
|
0.47-bp155.2.9 info | GA Release | 2023-05-17 | 15 SP5 |
|
|
0.47-bp154.1.17 info | GA Release | 2022-05-09 | 15 SP4 |
|
|
0.47-bp153.1.12 info | GA Release | 2021-03-06 | 15 SP3 |
|
|
0.47-bp152.3.14 info | GA Release | 2020-04-17 | 15 SP2 |
|
|
0.47-bp151.3.1 info | GA Release | 2019-07-16 | 15 SP1 |
|
|
0.47-bp151.2.11 info | GA Release | 2019-05-18 | 15 SP1 |
|
|
0.47-bp150.2.4 info | GA Release | 2018-07-30 | 15 |
|
|