| 1 | |
| 2 | === Log Statements === |
| 3 | |
| 4 | ==== Log Format Must Match the Format of a Regular Expression ==== |
| 5 | - '''Symbolic Name in XML Configuration''': checkLogStatementFormat |
| 6 | - '''Dependant Tags in XML Configuration''': logFormatRegExp, checkLogItemFormat, processSubsequentLogStatementsAsOne |
| 7 | |
| 8 | The check inspects the string in each log statement and matches it against a given regular expression. The predefined regular expression corresponds to the current ETSI guidelines. The regular expression can be adapted and customized for each profile however by changing the |
| 9 | content of the '''logFormatRegExp''' tag in a profile of the XML configuration. In addition, the first regexp group is matched against the name of outer compound of the log statement, i.e., the function, testcase, or altstep name. If the first group is empty, the latter additional check will be ignored. That means, if T3Q shall not check for the containing construct, there must be an artificial empty first group in the specified regexp. |
| 10 | |
| 11 | The current default regular expression is: |
| 12 | {{{ |
| 13 | [\*]{3}\s([fta]_[a-zA-Z0-9]+?):\s(INFO|WARNING|ERROR|PASS|FAIL|INCONC|TIMEOUT):\s.*?[\*]{3} |
| 14 | }}} |
| 15 | |
| 16 | The '''checkLogStatementFormat''' setting enables checking the ''whole'' log statement (joining multiple log items within a single log statement as one, variables are currently substituted by an empty string). If the individual log items need to be checked, the '''checkLogItemFormat''' setting shall be enabled instead. The same regular expression is used for checking individual log items. Note that even though the same regular expression. both checks are independent, meaning both can be enabled at the same time, with one checking the individual log items within a log statement and the other combining those log items and checking their concatenation (ignoring variables). Furthermore, by enabling the '''processSubsequentLogStatementsAsOne''' setting, subsequent log statements can be combined and analyzed as one (again ignoring variables within log statements), in a way similar to how log items are analyzed together within a log statement. This setting has no effect if '''checkLogStatementFormat''' is disabled. |
| 17 | |
| 18 | Note that subsequent log statements (without any other statements in between) are always combined when the '''processSubsequentLogStatementsAsOne''' setting is enabled. This may in some cases lead to unreliable results, if, for example, one well-formed log statement is followed by another not well-formed one, the combination of the two may still yield a valid log statement with the setting enabled. |
| 19 | |
| 20 | Note also if the '''processSubsequentLogStatementsAsOne''' setting is enabled, the subsequent log statements that are combined together are analyzed as a bundle starting with the first log statement in the sequence, meaning that the subsequent log statements are not analyzed individually again. |
| 21 | |
| 22 | |
| 23 | '''Example:''' |
| 24 | |
| 25 | [[Include(source:trunk/t3q-examples/checkLogFormat/checkLogFormat.ttcn3, text/x-rst)]] |
| 26 | |
| 27 | |
| 28 | ==== External Function Invocation Must Be Preceded By A Log Statement ==== |
| 29 | - '''Symbolic Name in XML Configuration''': checkExternalFunctionInvocationPrecededByLogStatement |
| 30 | - '''Dependant Tags in XML Configuration''': - |
| 31 | |
| 32 | Checks whether any invocation of an external function is preceded by a log statement. The examples shall generated warnings for |
| 33 | all the invocations that do not have a log statement preceding them directly (tagged as ''bad''). |
| 34 | |
| 35 | '''Example:''' |
| 36 | |
| 37 | [[Include(source:/trunk/t3q-examples/checkExternalFunctionInvocationPrecededByLogStatement/checkExternalFunctionInvocationPrecededByLogStatement.ttcn3, text/x-rst)]] |
| 38 | |
| 39 | Note that if an external function is called within a constant or a template definition on the module level, an information message will be provided that in such a context it is not possible to have a log statement following it. Note also that if a function definition cannot be resolved, a corresponding information message will be provided as well. |
| 40 | |
| 41 | ==== Inconclusive or Fail Setverdict Statement Must be Preceded by a Log Statement ==== |
| 42 | - '''Symbolic Name in XML Configuration''': checkInconcOrFailSetVerdictPrecededByLog |
| 43 | - '''Dependant Tags in XML Configuration''': - |
| 44 | |
| 45 | Checks whether setverdict statements that set inconc or fail verdicts are preceded by log statements. In the example, the first |
| 46 | alt statement represents the expected syntax whereas the second alt statement fails to have log statements before the two existing |
| 47 | fail and inconc setverdict statements. |
| 48 | |
| 49 | '''Example:''' |
| 50 | |
| 51 | [[Include(source:trunk/t3q-examples/checkInconcOrFailSetVerdictPrecededByLog/checkInconcOrFailSetVerdictPrecededByLog.ttcn3, text/x-rst)]] |
| 52 | |