tempesta-tech / tempesta-test

Test suite for Tempesta FW
11 stars 5 forks source link

Adding more informative logs into the framework #695

Open KonsKo opened 1 month ago

KonsKo commented 1 month ago

Currently, we log not much actions that happen during the framework work. And some of them are not informative at all.

Let's consider an example from helpers/stateful.py

Method start from class Stateful

    def start(self, obj=""):
        """Try to start object"""
        if self.state != STATE_STOPPED:
            if obj == "":
                tf_cfg.dbg(3, "Not stopped")
            else:
                tf_cfg.dbg(3, "%s not stopped" % obj)
            return
        self.state = STATE_BEGIN_START
        self._exceptions = list()
        self.run_start()
        self.state = STATE_STARTED

class Stateful is parent for many other classes. Here, we do not have any logged information about what is happening, I mean, information, that we beginning start and for what, information about states, information, that we finished start successfully for what, etc. Also, line such tf_cfg.dbg(3, "Not stopped") is not informative at all, as I mentioned, class Stateful is parent for many other classes, and if this log is involved, we do not have any information.

In opposite, in some places we have duplicated logs such:

24-10-03 22:37:00.555500 WARNING   |      lxc cmd: sudo lxc list -f json                                                                                                                                                                       tf_cfg.py:245
24-10-03 22:37:00.556650 INFO      |      Run command 'sudo lxc list -f json' on host localhost with environment {} 

It is hard to debug problems during the work.