Test::S...LogMixin(3)
π Test::S...LogMixin(3) π
okay bestie, gather round, because this one is two packages in one trench coat and both of them are lowkey serving. it's straight out of the User Contributed Perl Documentation, it's a perl manpage, and we're doing this together, no cap. π«Άβ¨
β¨ NAME β¨
Test::Smoke::LogMixin β a "Role" that adds logging methods to "traditional" objects. π
π¦ SYNOPSIS π¦
package MyPackage;
use warnings;
use strict;
use Test::Smoke::LogMixin;
sub new {
my $class = shift;
my %selfish = @_;
$selfish{_verbose} ||= 0;
return bless \%selfish, $class;
}
1;
package main;
use MyPackage;
my $o = MyPackage->new(_verbose => 2);
$o->log_debug("This will end up in the log");
π DESCRIPTION π
so picture this: this package, with all of its mixin-methods, is basically acting like a role β it extends your traditional (like, created with bless()) object with 4 new methods. not 3, not 5. four. slay. π
it's also carrying around some extra Test::Smoke::App::Base logic to figure out the log-level (by looking at $app->option('verbose')). and for other object types? it tries to fiend if there are methods by the name "verbose" or "v", or maybe the keys "_verbose" or "_v" (See also Test::Smoke::ObjectBase). detective behavior honestly. π
and the tea on the three log methods: they use the sprintf() way of composing strings whenever more than 1 argument is passed! periodt. π
πΈ $app->verbosity πΈ
Return the verbosity of this app. iconic, no notes.
Arguments
None. she's low maintenance. π
Returns
The value of either "_verbose" or "_v"
πΈ $app->log_warn($fmt, @values) πΈ
"prinf $fmt, @values" to the currently selected filehandle.
Arguments
Positional.
$fmt=> a (s)printf format- The format gets an extra new line if one wasn't present.
@values=> optional vaules for the template.
Returns
use in void context.
Exceptions
None.
πΈ $app->log_info($fmt, @values) πΈ
"prinf $fmt, @values" to the currently selected filehandle if the 'verbose' option is set.
Arguments
Positional.
$fmt=> a (s)printf format- The format gets an extra new line if one wasn't present.
@values=> optional vaules for the template.
Returns
use in void context.
Exceptions
None.
πΈ $app->log_debug($fmt, @values) πΈ
"prinf $fmt, @values" to the currently selected filehandle if the 'verbose' option is set to a value > 1.
Arguments
Positional.
$fmt=> a (s)printf format- The format gets an extra new line if one wasn't present.
@values=> optional vaules for the template.
Returns
use in void context.
Exceptions
None.
okay bestie, quick vibe check β that was package number one. now we're switching gears, because the same page also documents a whole other little helper. keep scrolling. π¦
π NAME π
Test::Smoke::Logger β Helper object for logging.
π SYNOPSIS π
use Test::Smoke::LogMixin;
my $logger = Test::Smoke::Logger->new(v => 1);
$logger->log_warn("Minimal log level"); # v >= 0
$logger->log_info("Medium log level"); # v <= 1
$logger->log_debug("High log level"); # v > 1
π DESCRIPTION π
π Test::Smoke::Logger->new(%arguments) π
Return a logger instance. your very own little logger baby. πΌ
Arguments
Named, hash:
v=><0|1|2>
Returns
The Test::Smoke::Logger instance.
π COPYRIGHT π
(c) 2020, All rights reserved.
- Abe Timmerman
<abeltje@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See:
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
and that's the whole page, bestie!! π₯³ this one shipped with perl v5.42.0 and the date on it is 2025-07-25 β so like, remember that vintage when you cite it. now go forth and log responsibly, my main character. ππ¦β¨
π¦ where this page comes from
- fedora 43: perl-Test-Smoke 1.84-2.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms