Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- proc logger() {.async.} =
- var pos = 0i64;
- while true:
- try:
- let line = file.read_line();
- let words = line.split(' ');
- pos = file.get_file_pos();
- case words[0]
- of "REQ":
- display("Request", words[1..<words.len()].join(" "), Success, HighPriority)
- of "INF":
- display("Info", words[2..<words.len()].join(" "), Message, words[1].to_priority())
- of "ERR":
- display("Error", words[2..<words.len()].join(" "), Error, words[1].to_priority())
- of "WRN":
- display("Warning", words[2..<words.len()].join(" "), Warning, words[1].to_priority())
- of "FTL":
- display("Fatal", words[2..<words.len()].join(" "), Error, words[1].to_priority())
- except:
- sleep 300;
- if file.reopen("remedias.log"):
- file.set_file_pos(pos);
- else:
- display("watchman error", "couldn't reopen log", Error, HighPriority);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement