Advertisement
Guest User

Fixed

a guest
Sep 23rd, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.93 KB | None | 0 0
  1. proc logger() {.async.} =
  2.   var pos = 0i64;
  3.   while true:
  4.     try:
  5.       let line = file.read_line();
  6.       let words = line.split(' ');
  7.       pos = file.get_file_pos();
  8.       case words[0]
  9.         of "REQ":
  10.           display("Request", words[1..<words.len()].join(" "), Success, HighPriority)
  11.         of "INF":
  12.           display("Info", words[2..<words.len()].join(" "), Message, words[1].to_priority())
  13.         of "ERR":
  14.           display("Error", words[2..<words.len()].join(" "), Error, words[1].to_priority())
  15.         of "WRN":
  16.           display("Warning", words[2..<words.len()].join(" "), Warning, words[1].to_priority())
  17.         of "FTL":
  18.           display("Fatal", words[2..<words.len()].join(" "), Error, words[1].to_priority())
  19.     except:
  20.       sleep 300;
  21.       if file.reopen("remedias.log"):
  22.         file.set_file_pos(pos);
  23.       else:
  24.         display("watchman error", "couldn't reopen log", Error, HighPriority);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement