NAME

OPCUA::Open62541::Test::Logger - manage open62541 log file for testing

SYNOPSIS

use OPCUA::Open62541::Test::Logger;

my $logger = OPCUA::Open62541::Test::Server->logger();

DESCRIPTION

Write the output of a server into a log file. Wait until a given regular expression matches a line in the file.

METHODS

$logger = OPCUA::Open62541::Test::Logger->new(%args);

Create a new test logger instance. Usually called from test server.

$args{logger}

Required logger instance of the server config.

$logger->file($file)

Start writing to log file.

$logger->loggrep($regex, $timeout, $count)

Check if regex is present in the log file. If the process is still alive and a timeout is given, repeat the check for the number of seconds. If count is given, wait for this number of matches. Returns the number of matches.

$logger->pid($pid)

Optionally set the id of the process that is writing to log file. When grepping it will not wait for more input if the process is dead. Returns the pid.

SEE ALSO

OPCUA::Open62541, OPCUA::Open62541::Test::Server

AUTHORS

Alexander Bluhm <bluhm@genua.de>,

COPYRIGHT AND LICENSE

Copyright (c) 2020 Alexander Bluhm

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Thanks to genua GmbH, https://www.genua.de/ for sponsoring this work.