Lines Matching refs:syslog

52 can_ok( 'Sys::Syslog' => qw(openlog syslog syslog setlogmask setlogsock closelog) );
63 # syslog()
64 eval { syslog() };
65 like( $@, qr/^syslog: expecting argument \$priority/,
66 "calling syslog() with no argument" );
68 eval { syslog(undef) };
69 like( $@, qr/^syslog: expecting argument \$priority/,
70 "calling syslog() with one undef argument" );
72 eval { syslog('') };
73 like( $@, qr/^syslog: expecting argument \$format/,
74 "calling syslog() with one empty argument" );
77 my $test_string = "uid $< is testing Perl $] syslog(3) capabilities";
81 # try to open a syslog using a Unix or stream socket
97 # open syslog with a "local0" facility
101 skip "can't connect to syslog", 6 if $@ =~ /^no connection to syslog available/;
105 # syslog()
106 $r = eval { syslog('info', "$test_string by connecting to a $sock_type socket") } || 0;
107 is( $@, '', "syslog() called with level 'info'" );
108 ok( $r, "syslog() should return true: '$r'" );
119 # try to open a syslog using all the available connection methods
140 skip "can't connect to syslog", 18 if $@ =~ /^no connection to syslog available/;
146 skip "can't connect to syslog", 16 if $@ =~ /^no connection to syslog available/;
150 # syslog() with negative level, should fail
151 $r = eval { syslog(-1, "$test_string by connecting to a $sock_type socket") } || 0;
152 like( $@, '/^syslog: invalid level\/facility: /', "[$sock_type] syslog() called with level -1" );
153 ok( !$r, "[$sock_type] syslog() should return false: '$r'" );
155 # syslog() with invalid level, should fail
156 $r = eval { syslog("plonk", "$test_string by connecting to a $sock_type socket") } || 0;
157 like( $@, '/^syslog: invalid level\/facility: /', "[$sock_type] syslog() called with level plonk" );
158 ok( !$r, "[$sock_type] syslog() should return false: '$r'" );
160 # syslog() with levels "info" and "notice" (as a strings), should fail
161 $r = eval { syslog('info,notice', "$test_string by connecting to a $sock_type socket") } || 0;
162 like( $@, '/^syslog: too many levels given: notice/', "[$sock_type] syslog() called with level 'info,notice'" );
163 ok( !$r, "[$sock_type] syslog() should return false: '$r'" );
165 # syslog() with facilities "local0" and "local1" (as a strings), should fail
166 $r = eval { syslog('local0,local1', "$test_string by connecting to a $sock_type socket") } || 0;
167 like( $@, '/^syslog: too many facilities given: local1/', "[$sock_type] syslog() called with level 'local0,local1'" );
168 ok( !$r, "[$sock_type] syslog() should return false: '$r'" );
170 # syslog() with level "info" (as a string), should pass
171 $r = eval { syslog('info', "$test_string by connecting to a $sock_type socket") } || 0;
172 is( $@, '', "[$sock_type] syslog() called with level 'info' (string)" );
173 ok( $r, "[$sock_type] syslog() should return true: '$r'" );
175 # syslog() with level "info" (as a macro), should pass
177 $r = eval { syslog(LOG_INFO(), "$test_string by connecting to a $sock_type socket, setting a fake errno: %m") } || 0;
179 is( $@, '', "[$sock_type] syslog() called with level 'info' (macro)" );
180 ok( $r, "[$sock_type] syslog() should return true: '$r'" );
208 if (-x "/usr/sbin/syslog-ng") {
209 ok( $r, "setlogsock() on Cygwin with syslog-ng should return true: '$r'" );
212 ok( !$r, "setlogsock() on Cygwin without syslog-ng should return false: '$r'" );