7
Padre::Logger - Compile-time logging library for Padre
11
# In the launch/dev.pl script
13
$Padre::Logger::DEBUG = 1;
18
# In each Padre::Foo class
22
TRACE('->method') if DEBUG;
29
This is a logging utility class for Padre. It provides a basic set of
30
simple functionality that allows for logging/debugging/tracing statements to be
31
used in Padre that will compile out of the application when not in use.
38
use Padre::Constant ();
40
our $VERSION = '0.60';
43
my $pkg = ( caller() )[0];
46
use constant DEBUG => !! (
47
defined(\$${pkg}::DEBUG) ? \$${pkg}::DEBUG :
48
defined(\$Padre::Logger::DEBUG) ? \$Padre::Logger::DEBUG :
52
*TRACE = *Padre::Logger::TRACE;
53
TRACE('::DEBUG enabled') if DEBUG;
57
die("Failed to enable debugging for $pkg") if $@;
61
# Global trace function
63
my $time = scalar localtime time;
64
my $package = ( caller() )[0];
65
my $logfile = Padre::Constant::LOG_FILE;
66
open my $fh, '>>', $logfile or return;
67
foreach my $message (@_) {
81
# Copyright 2008-2010 The Padre development team as listed in Padre.pm.
83
# This program is free software; you can redistribute it and/or
84
# modify it under the same terms as Perl 5 itself.