Updated main.py

Added another example of how to log with pseudologs
This commit is contained in:
Ethan Smith-Coss 2022-05-03 18:12:59 +01:00
parent 5e922c5515
commit a0e487a2a7
Signed by: TheOnePath
GPG Key ID: 4E7D436CE1A0BAF1

11
main.py
View File

@ -1,5 +1,6 @@
if __name__ == "__main__":
import _logger
import time
logger = _logger.Logger()
@ -7,4 +8,12 @@ if __name__ == "__main__":
logger.warn("This is a warning message").withConsole()
logger.error("This is an error message").withConsole()
logger.debug("A message to file but not TTY")
logger.debug("A message to file but not TTY")
msg = "Checking if 1 + 1 = 2..."
logger.debug(msg, end="\r").withConsole()
time.sleep(1)
if 1 + 2 != 2:
logger.error(msg + "failed.").withConsole()
else:
logger.debug(msg + "ok.").withConsole()