aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/11-Shared-Logging.t22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/11-Shared-Logging.t b/t/11-Shared-Logging.t
index 5b18ae9c..db27d5b2 100644
--- a/t/11-Shared-Logging.t
+++ b/t/11-Shared-Logging.t
@@ -6,6 +6,7 @@ use Data::Dumper;
BEGIN {
use_ok( 'ManaTools::Shared::Logging' ) || print "ManaTools::Shared::Logging failed!\n";
+ use_ok( 'ManaTools::Shared::JournalCtl' ) || print "JournalCtl failed!\n";
}
ok ( my $obj = ManaTools::Shared::Logging->new(), 'new_logging');
@@ -16,4 +17,25 @@ ok ( $obj->W("test warning %d", 2), 'warning_logging');
ok ( $obj->E("test err %d", 3), 'err_logging');
ok ( $obj->D("test debug %d", 4), 'debug_logging');
+$obj = undef;
+my $o = ManaTools::Shared::JournalCtl->new(this_boot=>1,);
+$o->identifier('test_logging');
+
+ok ( $obj = ManaTools::Shared::Logging->new(ident => 'test_logging'), 'new_test_logging');
+ok ( $obj->D("test debug %d", 5), 'debug_logging as test_logging');
+ok ( $obj->I("test info %d", 6), 'info_logging as test_logging');
+ok ( $obj->W("test warning %d", 7), 'warning_logging as test_logging');
+ok ( $obj->E("test err %d", 8), 'err_logging as test_logging');
+#let's wait journalctl to be updated
+sleep 1;
+my $c = $o->getLog();
+my $str = $c->[-1];
+ok($str =~ "test err 8", 'test err found');
+$str = $c->[-2];
+ok($str =~ "test warning 7", 'test warning found');
+$str = $c->[-3];
+ok($str =~ "test info 6", 'test info found');
+$str = $c->[-4];
+ok($str =~ "test debug 5", 'test debug found');
+
done_testing;