3
3
import os
4
4
import time
5
5
6
+ from core .log .log import Log
6
7
from core .settings import Settings
7
8
from core .utils .file_utils import File
8
9
@@ -50,24 +51,24 @@ def wait_for_log(log_file, string_list, not_existing_string_list=None, timeout=4
50
51
log = File .extract_part_of_text (log , verified_flag )
51
52
for item in string_list :
52
53
if item in log :
53
- print "'{0}' found." .format (item )
54
+ Log . info ( "'{0}' found." .format (item ) )
54
55
else :
55
56
not_found_list .append (item )
56
57
if not_found_list == []:
57
58
all_items_found = True
58
- print "Log contains: {0}" .format (string_list )
59
+ Log . info ( "Log contains: {0}" .format (string_list ) )
59
60
break
60
61
else :
61
- print "'{0}' NOT found. Wait..." .format (not_found_list )
62
+ Log . info ( "'{0}' NOT found. Wait..." .format (not_found_list ) )
62
63
time .sleep (check_interval )
63
64
if 'BUILD FAILED' in log :
64
- print 'BUILD FAILED. No need to wait more time!'
65
+ Log . error ( 'BUILD FAILED. No need to wait more time!' )
65
66
break
66
67
if 'Unable to sync files' in log :
67
- print 'Sync process failed. No need to wait more time!'
68
+ Log . error ( 'Sync process failed. No need to wait more time!' )
68
69
break
69
70
if 'errors were thrown' in log :
70
- print 'Multiple errors were thrown. No need to wait more time!'
71
+ Log . error ( 'Multiple errors were thrown. No need to wait more time!' )
71
72
break
72
73
73
74
# Mark that part of the log as verified by appending a flag at the end.
@@ -81,8 +82,7 @@ def wait_for_log(log_file, string_list, not_existing_string_list=None, timeout=4
81
82
for item in not_existing_string_list :
82
83
assert item not in log , "{0} found! It should not be in logs.\n Log:\n {1}" .format (item , log )
83
84
else :
84
- print "##### OUTPUT BEGIN #####\n "
85
- print log
86
- print "##### OUTPUT END #####\n "
87
- print ""
85
+ Log .debug ('##### OUTPUT BEGIN #####\n ' )
86
+ Log .debug (log )
87
+ Log .debug ('##### OUTPUT END #####\n ' )
88
88
assert False , "Output does not contain {0}" .format (not_found_list )
0 commit comments