Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. def get_all_log_data(log_name):
  2. try:
  3. print(os.getcwd())
  4. with open("/home/yakiza/Documents/CroW/crow/log/"+log_name+".log") as myfile:
  5. lines = myfile.readlines()
  6. i = 0
  7. Log_basket = []
  8.  
  9. while i < len(lines):
  10. #regex to capture date and time
  11. date_capture = re.search(r"([0-9]+\-[0-9]+\-[0-9]+) ([0-9]+\:[0-9]+)", lines[i])
  12.  
  13.  
  14. #regex to capture run, errors and failures
  15. run_captures = re.search(r"(?<=run=)[0-9]", lines[i])
  16.  
  17. errors_captures = re.search(r"(?<=errors=)[0-9]", lines[i])
  18. failures_captures = re.search(r"(?<=failures=)[0-9]", lines[i])
  19. for line in lines:
  20. print(line)
  21. print(re.search("(?<=errors=)[0-9]",line))
  22. print(errors_captures)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement