aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ManaTools/Module.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ManaTools/Module.pm')
-rw-r--r--lib/ManaTools/Module.pm35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/ManaTools/Module.pm b/lib/ManaTools/Module.pm
index b800d0b1..5bc8c064 100644
--- a/lib/ManaTools/Module.pm
+++ b/lib/ManaTools/Module.pm
@@ -157,6 +157,41 @@ has 'loc' => (
#=============================================================
+=head2 logger
+
+ logger attribute defines logging object that uses the loc attribute
+ and goes to Syslog. (see ManaTools::Shared::Logging for details).
+ You can use this attribute to log various messages:
+
+ $log->D("debugstuff: %s", $somestring);
+ $log->I("infostuff: %s", $somestring);
+ $log->W("warnstuff: %s", $somestring);
+ $log->E("errorstuff: %s", $somestring);
+
+ if you wish to trace (goes to STDERR):
+
+ $log->trace(1);
+
+=cut
+
+#=============================================================
+has 'logger' => (
+ is => 'rw',
+ isa => 'ManaTools::Shared::Logging',
+ lazy => 1,
+ init_arg => undef,
+ required => 0,
+ default => sub {
+ my $self = shift;
+ # make sure to trigger loc & name first
+ return ManaTools::Shared::Logging->new(loc => $self->loc(), ident => $self->name());
+ },
+ handles => ['D','I','W','E'],
+);
+
+
+#=============================================================
+
=head2 commandline
commandline attribute defines the given command line, if