my $code = shift;
my @values = @_;
return log_trace {
- do { local $_ = Data::Dumper::Concise::Dumper @values; $code->() };
+ if (@values) {
+ do { local $_ = Data::Dumper::Concise::Dumper @values; $code->() };
+ } else {
+ do { local $_ = '()'; $code->() };
+ }
} @values
}
my $code = shift;
my @values = @_;
log_debug {
- do { local $_ = Data::Dumper::Concise::Dumper @values; $code->() };
+ if (@values) {
+ do { local $_ = Data::Dumper::Concise::Dumper @values; $code->() };
+ } else {
+ do { local $_ = '()'; $code->() };
+ }
} @values
}
my $code = shift;
my @values = @_;
log_info {
- do { local $_ = Data::Dumper::Concise::Dumper @values; $code->() };
+ if (@values) {
+ do { local $_ = Data::Dumper::Concise::Dumper @values; $code->() };
+ } else {
+ do { local $_ = '()'; $code->() };
+ }
} @values
}
my $code = shift;
my @values = @_;
log_warn {
- do { local $_ = Data::Dumper::Concise::Dumper @values; $code->() };
+ if (@values) {
+ do { local $_ = Data::Dumper::Concise::Dumper @values; $code->() };
+ } else {
+ do { local $_ = '()'; $code->() };
+ }
} @values
}
my $code = shift;
my @values = @_;
log_error {
- do { local $_ = Data::Dumper::Concise::Dumper @values; $code->() };
+ if (@values) {
+ do { local $_ = Data::Dumper::Concise::Dumper @values; $code->() };
+ } else {
+ do { local $_ = '()'; $code->() };
+ }
} @values
}
my $code = shift;
my @values = @_;
log_fatal {
- do { local $_ = Data::Dumper::Concise::Dumper @values; $code->() };
+ if (@values) {
+ do { local $_ = Data::Dumper::Concise::Dumper @values; $code->() };
+ } else {
+ do { local $_ = '()'; $code->() };
+ }
} @values
}
]
OUT
}
+
+
+
+{
+ my @foo = Dlog_trace { "nothing: $_" } ();
+ ok( eq_array(\@foo, []), 'Dlog_trace passes nothing through correctly');
+ is( $var_log->var, 'tnothing: ()', 'Output for Dlog_trace is correct');
+}
+
+{
+ my @foo = Dlog_debug { "nothing: $_" } ();
+ ok( eq_array(\@foo, []), 'Dlog_debug passes nothing through correctly');
+ is( $var_log->var, 'dnothing: ()', 'Output for Dlog_debug is correct');
+}
+
+{
+ my @foo = Dlog_info { "nothing: $_" } ();
+ ok( eq_array(\@foo, []), 'Dlog_info passes nothing through correctly');
+ is( $var_log->var, 'inothing: ()', 'Output for Dlog_info is correct');
+}
+
+{
+ my @foo = Dlog_warn { "nothing: $_" } ();
+ ok( eq_array(\@foo, []), 'Dlog_warn passes nothing through correctly');
+ is( $var_log->var, 'wnothing: ()', 'Output for Dlog_warn is correct');
+}
+
+{
+ my @foo = Dlog_error { "nothing: $_" } ();
+ ok( eq_array(\@foo, []), 'Dlog_error passes nothing through correctly');
+ is( $var_log->var, 'enothing: ()', 'Output for Dlog_error is correct');
+}
+
+{
+ my @foo = Dlog_fatal { "nothing: $_" } ();
+ ok( eq_array(\@foo, []), 'Dlog_fatal passes nothing through correctly');
+ is( $var_log->var, 'fnothing: ()', 'Output for Dlog_fatal is correct');
+}
+