-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Miguel edited this page Aug 29, 2022
·
3 revisions
first import the module into your script:
from logpy import Logger
create an instance of the logger class, completing all the requested params:
from logpy import Logger
console = Logger(save_log=True, date_format="%Y-%m-%d", log_path=".", name="Loshad's logger")
after all this you can use all of these methods:
- critical, ex.:
console.critical("...")
- error, ex.:
console.error("...")
- warning, ex.:
console.warning("...")
- success, ex.:
console.success("...")
- info, ex.:
console.info("...")
- log, ex.:
console.log("...")
The default log method can not save the generated log in a file
if you has setted the save_log parameter to true,
the logs will be saved in the specified path in a logs.log
file.
If any method raises a FileNotFoundError exception,
try running the init method, that will create the file.
from logpy import logger
console = Logger(save_log=True, date_format="%Y-%m-%d", log_path=".", name="Loshad's logger")
console.init()