@@ -2222,15 +2222,9 @@ If this regular expression is set, matches it with the output generated.
22222222
22232223=item log_like => [ qr/required message/ ]
22242224
2225- If given, it must be an array reference containing a list of regular
2226- expressions that must match against the server log, using
2227- C<Test::More::like() > .
2228-
22292225=item log_unlike => [ qr/prohibited message/ ]
22302226
2231- If given, it must be an array reference containing a list of regular
2232- expressions that must NOT match against the server log. They will be
2233- passed toC<Test::More::unlike() > .
2227+ SeeC<log_check(...) > .
22342228
22352229=back
22362230
@@ -2251,16 +2245,6 @@ sub connect_ok
22512245$sql =" SELECT\$\$ connected with$connstr \$\$ " ;
22522246}
22532247
2254- my (@log_like ,@log_unlike );
2255- if (defined ($params {log_like }))
2256- {
2257- @log_like = @{$params {log_like } };
2258- }
2259- if (defined ($params {log_unlike }))
2260- {
2261- @log_unlike = @{$params {log_unlike } };
2262- }
2263-
22642248my $log_location =-s $self -> logfile;
22652249
22662250# Never prompt for a password, any callers of this routine should
@@ -2281,20 +2265,7 @@ sub connect_ok
22812265
22822266is($stderr ," " ," $test_name : no stderr" );
22832267
2284- if (@log_like or @log_unlike )
2285- {
2286- my $log_contents =
2287- PostgreSQL::Test::Utils::slurp_file($self -> logfile,$log_location );
2288-
2289- while (my $regex =shift @log_like )
2290- {
2291- like($log_contents ,$regex ," $test_name : log matches" );
2292- }
2293- while (my $regex =shift @log_unlike )
2294- {
2295- unlike($log_contents ,$regex ," $test_name : log does not match" );
2296- }
2297- }
2268+ $self -> log_check($test_name ,$log_location ,%params );
22982269}
22992270
23002271=pod
@@ -2314,7 +2285,7 @@ If this regular expression is set, matches it with the output generated.
23142285
23152286=item log_unlike => [ qr/prohibited message/ ]
23162287
2317- SeeC<connect_ok (...) > , above .
2288+ SeeC<log_check (...) > .
23182289
23192290=back
23202291
@@ -2325,16 +2296,6 @@ sub connect_fails
23252296local $Test::Builder::Level =$Test::Builder::Level + 1;
23262297my ($self ,$connstr ,$test_name ,%params ) =@_ ;
23272298
2328- my (@log_like ,@log_unlike );
2329- if (defined ($params {log_like }))
2330- {
2331- @log_like = @{$params {log_like } };
2332- }
2333- if (defined ($params {log_unlike }))
2334- {
2335- @log_unlike = @{$params {log_unlike } };
2336- }
2337-
23382299my $log_location =-s $self -> logfile;
23392300
23402301# Never prompt for a password, any callers of this routine should
@@ -2352,20 +2313,7 @@ sub connect_fails
23522313like($stderr ,$params {expected_stderr }," $test_name : matches" );
23532314}
23542315
2355- if (@log_like or @log_unlike )
2356- {
2357- my $log_contents =
2358- PostgreSQL::Test::Utils::slurp_file($self -> logfile,$log_location );
2359-
2360- while (my $regex =shift @log_like )
2361- {
2362- like($log_contents ,$regex ," $test_name : log matches" );
2363- }
2364- while (my $regex =shift @log_unlike )
2365- {
2366- unlike($log_contents ,$regex ," $test_name : log does not match" );
2367- }
2368- }
2316+ $self -> log_check($test_name ,$log_location ,%params );
23692317}
23702318
23712319=pod
@@ -2559,6 +2507,68 @@ sub issues_sql_like
25592507
25602508=pod
25612509
2510+ =item $node->log_check($offset, $test_name, %parameters)
2511+
2512+ Check contents of server logs.
2513+
2514+ =over
2515+
2516+ =item $test_name
2517+
2518+ Name of test for error messages.
2519+
2520+ =item $offset
2521+
2522+ Offset of the log file.
2523+
2524+ =item log_like => [ qr/required message/ ]
2525+
2526+ If given, it must be an array reference containing a list of regular
2527+ expressions that must match against the server log, using
2528+ C<Test::More::like() > .
2529+
2530+ =item log_unlike => [ qr/prohibited message/ ]
2531+
2532+ If given, it must be an array reference containing a list of regular
2533+ expressions that must NOT match against the server log. They will be
2534+ passed toC<Test::More::unlike() > .
2535+
2536+ =back
2537+
2538+ =cut
2539+
2540+ sub log_check
2541+ {
2542+ my ($self ,$test_name ,$offset ,%params ) =@_ ;
2543+
2544+ my (@log_like ,@log_unlike );
2545+ if (defined ($params {log_like }))
2546+ {
2547+ @log_like = @{$params {log_like } };
2548+ }
2549+ if (defined ($params {log_unlike }))
2550+ {
2551+ @log_unlike = @{$params {log_unlike } };
2552+ }
2553+
2554+ if (@log_like or @log_unlike )
2555+ {
2556+ my $log_contents =
2557+ PostgreSQL::Test::Utils::slurp_file($self -> logfile,$offset );
2558+
2559+ while (my $regex =shift @log_like )
2560+ {
2561+ like($log_contents ,$regex ," $test_name : log matches" );
2562+ }
2563+ while (my $regex =shift @log_unlike )
2564+ {
2565+ unlike($log_contents ,$regex ," $test_name : log does not match" );
2566+ }
2567+ }
2568+ }
2569+
2570+ =pod
2571+
25622572=item $node->run_log(...)
25632573
25642574Runs a shell command like PostgreSQL::Test::Utils::run_log, but with connection parameters set