'Logging hook called before a test starts.'

@log.log_and_ignore_errors('pre-test    sysinfo    error:')
def log_before_each_test(self, test):

    if _LOG_INSTALLED_PACKAGES:
        self._installed_packages = self.sm.list_all()
        test_sysinfodir = self._get_sysinfodir(test.outputdir)
        installed_path = os.path.join(test_sysinfodir, 'installed_packages')
        installed_packages = '\n'.join(self._installed_packages)
        utils.open_write_close(installed_path, installed_packages)
    if os.path.exists('/var/log/messages'):
        stat = os.stat('/var/log/messages')
        self._messages_size = stat.st_size
        self._messages_inode = stat.st_ino
    elif os.path.exists('/var/log/syslog'):
        stat = os.stat('/var/log/syslog')
        self._messages_size = stat.st_size
        self._messages_inode = stat.st_ino
