add basic timestamp formatting
This commit is contained in:
parent
1b0e16d97b
commit
134ef07fd5
@ -13,10 +13,10 @@ import cleanupagents.Utils
|
||||
from cleanupagents.Utils import Singleton
|
||||
from cleanupagents.Utils import to_bool
|
||||
|
||||
CONSOLE_FORMAT = "%(asctime)s {}[%(levelname)s]{} %(message)s"
|
||||
CONSOLE_FORMAT = "{}[%(levelname)s]{} %(message)s"
|
||||
FILE_FORMAT = "%(asctime)s %(levelname)s %(message)s"
|
||||
JSON_FORMAT = "(asctime) (levelname) (message)"
|
||||
|
||||
TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
|
||||
|
||||
def _should_do_markup():
|
||||
py_colors = os.environ.get("PY_COLORS", None)
|
||||
@ -85,7 +85,7 @@ class Log:
|
||||
def _get_file_handler(self, logfile, json=False):
|
||||
handler = logging.handlers.RotatingFileHandler(logfile, maxBytes=512000, backupCount=5)
|
||||
handler.setLevel(logging.DEBUG)
|
||||
handler.setFormatter(logging.Formatter(FILE_FORMAT))
|
||||
handler.setFormatter(logging.Formatter(FILE_FORMAT, TIME_FORMAT))
|
||||
|
||||
if json:
|
||||
handler.setFormatter(MultilineJsonFormatter(JSON_FORMAT))
|
||||
|
Reference in New Issue
Block a user