aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2015-08-05 11:19:48 +0200
committerAngelo Naselli <anaselli@linux.it>2015-08-05 11:19:48 +0200
commit1435dd35e9f18527da90edb0de6e639281a7d2b1 (patch)
treea4d3daa4fb653e2e70b0d4b1ce1cd9eabc6c5c1e /t
parent61f7a70f55d186507a9fc0ef652e92d0b72fb59a (diff)
downloadmanatools-1435dd35e9f18527da90edb0de6e639281a7d2b1.tar
manatools-1435dd35e9f18527da90edb0de6e639281a7d2b1.tar.gz
manatools-1435dd35e9f18527da90edb0de6e639281a7d2b1.tar.bz2
manatools-1435dd35e9f18527da90edb0de6e639281a7d2b1.tar.xz
manatools-1435dd35e9f18527da90edb0de6e639281a7d2b1.zip
Added identifier on logging (see Sys::Syslog)
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;