cn-py-serv/server/urlhandler.py
Иван Солнцев a4f7411e10 Add more debug messages
- Move log initialization to config file;
- Add meta tag for charset to index file.
2024-07-03 14:06:19 +03:00

22 lines
808 B
Python

import logging
log = logging.getLogger(__name__)
def path(path="/", _type="static-file", link="index.html", methods=("GET",)):
log.debug("Start generate path for %s address" % path)
if _type == "static-file":
log.info("Path %s is %s and linked %s for methods %s" % (path, _type, link, methods))
return {path: (methods, _type, "static/{}".format(link))}
elif _type == "redirect":
log.info("Path %s is %s and linked %s for methods %s" % (path, _type, link, methods))
return {path: (methods, _type, link)}
elif _type == "function":
log.info("Path %s is %s and linked %s for methods %s" % (path, _type, link, methods))
return {path: (methods, _type, link)}
else:
log.error("Path %s is %s but it type is unknown" % (path, _type))