Project

General

Profile

Actions

action #29399

closed

Escape function parameter before logging them

Added by nicksinger over 6 years ago. Updated about 4 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Feature requests
Target version:
Start date:
2017-12-14
Due date:
% Done:

0%

Estimated time:

Description

Observation

While reviewing some jobs, I stumbled over this line in the autoinst-log.txt:

[Thu Dec 14 04:10:45 2017] [12032:debug] <<< testapi::type_string(string='root
', max_interval=250, wait_screen_changes=0, wait_still_screen=0)

The line break after root in the logs is because the parameter of type_string is actually "root\n" in the code.
This is kind of obscure for reviewers that want to know what happened there.

Acceptance criteria

  • AC1: Control characters within command strings within os-autoinst are not evaluated by the logging mechanism

Suggestions

IMHO it would be better if the parameter from type_string gets escaped before printing it to the log so it would show up as this:

[Thu Dec 14 04:10:45 2017] [12032:debug] <<< testapi::type_string(string='root\n', max_interval=250, wait_screen_changes=0, wait_still_screen=0)

This is especially beneficial if the string only consists of one control character (e.g. type_string('\t')).


Related issues 1 (0 open1 closed)

Copied to openQA Project - action #63808: Improve bmwqemu::log_call() function outputResolvedtinita2017-12-14

Actions
Actions

Also available in: Atom PDF