That's explained in Log::Log4perl
.. you can retrieve logger objects anywhere in the code. Note that there's no need to carry any logger references around with your functions and methods. You can get a logger anytime via a singleton mechanism:
poj#!/usr/bin/perl use strict; package MyModule; use Log::Log4perl; my $log = Log::Log4perl->get_logger("MyModule"); sub doit { $log->info("I'm doing it !"); } package main; use Log::Log4perl ':easy'; Log::Log4perl->easy_init(); $log->info("Asking doit"); MyModule->doit();
In reply to Re: Proper way to create packages and re-usable code?
by poj
in thread Proper way to create packages and re-usable code?
by bt101
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |