Log::Detect - Read logfiles to detect error and warning messages
use Log::Detect; my $d = new Log::Detect (); $d->read(filename=>"test_dir/test.log"); $d->write_stdout(); $d->write_append();
Log::Detect is used to read logfiles, and apply regexps to determine if the logfile contains any errors or warning messages. This is generally useful for those programs that refuse to return bad exit status when they should.
Log::Detect can also append a summary of all errors and warnings to the logfile, to a different file, or to the screen.
These variables may be specified with the new function, or with the set function. Most member functions also accept any of these variables when they are called.
The default filename for write_dino.
The default filename for write_simvision.
The name of the program to prepend to error messages. Defaults to $0.
A regexp where $1 returns the timestamp. Used by write_dino and write_simvision only.
If true, warnings are considered fatal errors. Defaults true.
If true, lack of a regexp matching 'finish' is considered fatal.
Returns the list of parsed actions. Each list element is a reference to a Log::Detect::Action, which has four accessor functions. lineno is the line number the message was detected on. filename is the file the error came from. action is the action specified with the regexp. text is the line itself.
Return string summary of all matching actions.
Returns the parsed actions, sorted by line number.
Returns the parsed actions, sorted by line number. Contains a maximum of report_limit number of errors.
Prepends new rules to the regexp list.
The regexps are matched against the text in order, with the first match action determining the result.
For example, the default: (warning => qr/Stopping due to warnings/i); (error => qr/(?i)%E|\bError ?[:!-]|Fatal ?[:!-]|\] Error [0-9]/); (warning => qr/%W/i); (warning => qr/\bWarning ?[:!-]/i); (finish => qr/\*-\* All Finished \*-\*/);
Specifies that a line matching "stopping due to warnings" is a warning, as is any line with %W (VMS's error messages). A %E on a matching line is signaled as an error. As the rules are done in order, if the file has the line '%E stopping due to warnings', which matches both the "%E" and the "stopping due to warnings" regexps, the first match wins, and thus the action indicates a warning, not an error.
Clears the list of parsed actions, as if a read had never occurred.
Clears the list of regular expressions.
Constructs the class. Any variables described above may be passed to the constructor.
Call when the current parse_text is complete, and any partially completed messages should be emptied out.
Parse_text will check any parameters for error messages. If complete lines are not given, the line is buffered until more arrives.
You must call parse_start before the first call to this function, and must call parse_eof to avoid missing an error that is not newline terminated at the end of the file.
Called to indicate future calls will be made to parse_text.
Read parses the logfile specified with filename=>. Each line is compared against the regular expressions in turn, forming a list of actions.
Set takes a named parameter list and sets those variables.
summary returns a two element list. The first element is a text message describing if errors or warnings were found. The second contains the text lines from the file which had errors or warnings.
write_append appends to a file, by default the same exact logfile, any errors or warnings that were found.
write_dino prints to a file Dinotrace annotations for any errors or warnings that were found in the logfile.
write_simvision prints to a file Simvision annotations for any errors or warnings that were found in the logfile.
write_stderr prints to the screen any errors or warnings that were found in the logfile.
Log-Detect is part of the http://www.veripool.org/ free EDA software tool suite. The latest version is available from CPAN and from http://www.veripool.org/.
Copyright 2000-2009 by Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
Wilson Snyder <wsnyder@wsnyder.org>
Log::Delayed, vtrace
To install Log::Detect, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::Detect
CPAN shell
perl -MCPAN -e shell install Log::Detect
For more information on module installation, please visit the detailed CPAN module installation guide.