]>
git.ipfire.org Git - people/ms/nitsi.git/blob - src/nitsi/logger.py
7 logger
= logging
.getLogger("nitsi.logger")
9 class Logger_Exeception(BaseException
):
12 # This function should create the necessary folders
13 # and touch the logging files
14 def init_logging(path
):
15 logger
.debug("Init logging directory")
16 if not os
.path
.isdir(path
):
17 logger
.error("{} is not a valid directory".format(path
))
20 path
= os
.path
.abspath(path
)
21 except BaseException
as e
:
22 logger
.error("Failed to get the absolute path for: {}".format(path
))
24 log_dir
= "{}/log".format(path
)
26 if not os
.path
.exists(log_dir
):
29 time_dir
= log_dir
+ "/" + time
.strftime("%Y-%m-%d_%H-%M-%S" ,time
.gmtime(time
.time()))
31 if os
.path
.exists(time_dir
):
32 logger
.error("Path {} alreday exist".format(time_dir
))
33 raise Logger_Exeception