summaryrefslogtreecommitdiffstats
path: root/lib/App/BorgRestore/PathTimeTable/DB.pm
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-11-12 10:52:35 +0100
committerFlorian Pritz <bluewind@xinu.at>2018-11-12 10:52:35 +0100
commit22784a47d44cb2369a6aa9c56a30e7fb98ca20ef (patch)
treeaaba4d512d0e15109dcc13dd6c9fad0670478a59 /lib/App/BorgRestore/PathTimeTable/DB.pm
parent0dbbbf6885d0031eb0476ea718ed62ed99a70b04 (diff)
downloadApp-BorgRestore-22784a47d44cb2369a6aa9c56a30e7fb98ca20ef.tar.gz
App-BorgRestore-22784a47d44cb2369a6aa9c56a30e7fb98ca20ef.tar.xz
Enable trace logging in BEGIN block for test suite
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App/BorgRestore/PathTimeTable/DB.pm')
-rw-r--r--lib/App/BorgRestore/PathTimeTable/DB.pm13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/App/BorgRestore/PathTimeTable/DB.pm b/lib/App/BorgRestore/PathTimeTable/DB.pm
index c01bbd0..221063c 100644
--- a/lib/App/BorgRestore/PathTimeTable/DB.pm
+++ b/lib/App/BorgRestore/PathTimeTable/DB.pm
@@ -2,7 +2,15 @@ package App::BorgRestore::PathTimeTable::DB;
use strictures 2;
use Function::Parameters;
-use Log::Any qw($log);
+BEGIN {
+ use Log::Any qw($log);
+ # Trace logging statements are disabled here since they incur a performance
+ # overhead because they are in tight loops. This block only works for the
+ # test suite code (set env var TAP_LOG_FILTER=none) since the normal
+ # application only changes the log level at run time. Hardcode to 1 when
+ # necessary (or write a test!).
+ use constant TRACE => $log->is_trace;
+}
=head1 NAME
@@ -22,9 +30,6 @@ properly sorted, this results in only a single database write for each path.
=cut
-# Trace logging statements are disabled here since they incur a performance
-# overhead because they are in tight loops. Change to 1 when necessary.
-use constant TRACE => 0;
method new($class: $deps = {}) {
return $class->new_no_defaults($deps);