Spaces:
Sleeping
Sleeping
File size: 682 Bytes
ab2b59d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s',
datefmt='%Y-%m-%d %H:%M')
def log(log_type,message):
try:
log_type = log_type.lower()
if log_type == "info":
return logging.info(message)
elif log_type == "debug":
return logging.debug(message)
elif log_type == "warning":
return logging.error(message)
elif log_type == "critical":
return logging.critical(message)
elif log_type == "error":
return logging.error(message)
except Exception as e:
return f"Invalid log type.Error : {e}"
|