Name : perl-Test-Log-Log4perl
| |
Version : 0.320.0
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp156.1.1
| Date : 2024-08-02 23:00:38
|
Group : Unspecified
| Source RPM : perl-Test-Log-Log4perl-0.320.0-lp156.1.1.src.rpm
|
Size : 0.03 MB
| |
Packager : https://www_suse_com/
| |
Summary : Test log4perl
|
Description :
This module can be used to test that you\'re logging the right thing with Log::Log4perl. It checks that we get what, and only what, we expect logged by your code.
The basic process is very simple. Within your test script you get one or more loggers from *Test::Log::Log4perl* with the \'get_logger\' method just like you would with *Log::Log4perl*. You\'re going to use these loggers to declare what you think the code you\'re going to test should be logging.
my $tlogger = Test::Log::Log4perl->get_logger(\"Foo::Bar\");
Then, for each test you want to do you need to start up the module.
Test::Log::Log4perl->start();
This diverts all subsequent attempts *Log::Log4perl* makes to log stuff and records them internally rather than passing them though to the Log4perl appenders as normal.
You then need to declare with the loggers we created earlier what we hope Log4perl will be asked to log. This is the same syntax as Test::Log::Log4perl uses, except if you want you can use regular expressions:
$tlogger->debug(\"fish\"); $tlogger->warn(qr/bar/);
You then need to run your code that you\'re testing.
some_code();
We finally need to tell *Test::Log4Perl* that we\'re done and it should do the comparisons.
Test::Log::Log4perl->end(\"test name\");
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl/15.6/noarch |