mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-22 14:38:00 +00:00
don't include date in logging when running via systemd
This commit is contained in:
parent
a6f1738b73
commit
491f19a9cb
|
@ -63,10 +63,10 @@ def set_level(level: LogLevel | str) -> None:
|
|||
|
||||
|
||||
def verbose(message: str, *args: Any, **kwargs: Any) -> None:
|
||||
if not logging.root.isEnabledFor(LogLevel['VERBOSE']):
|
||||
if not logging.root.isEnabledFor(LogLevel.VERBOSE):
|
||||
return
|
||||
|
||||
logging.log(LogLevel['VERBOSE'], message, *args, **kwargs)
|
||||
logging.log(LogLevel.VERBOSE, message, *args, **kwargs)
|
||||
|
||||
|
||||
debug: Callable = logging.debug
|
||||
|
@ -76,8 +76,6 @@ error: Callable = logging.error
|
|||
critical: Callable = logging.critical
|
||||
|
||||
|
||||
env_log_level: Path | str | None = os.environ.get('LOG_LEVEL', 'INFO').upper()
|
||||
|
||||
try:
|
||||
env_log_file: Path | None = Path(os.environ['LOG_FILE']).expanduser().resolve()
|
||||
|
||||
|
@ -89,10 +87,16 @@ handlers: list[Any] = [logging.StreamHandler()]
|
|||
if env_log_file:
|
||||
handlers.append(logging.FileHandler(env_log_file))
|
||||
|
||||
logging.addLevelName(LogLevel['VERBOSE'], 'VERBOSE')
|
||||
if os.environ.get('INVOCATION_ID'):
|
||||
logging_format = '%(levelname)s: %(message)s'
|
||||
|
||||
else:
|
||||
logging_format = '[%(asctime)s] %(levelname)s: %(message)s'
|
||||
|
||||
logging.addLevelName(LogLevel.VERBOSE, 'VERBOSE')
|
||||
logging.basicConfig(
|
||||
level = LogLevel.INFO,
|
||||
format = '[%(asctime)s] %(levelname)s: %(message)s',
|
||||
format = logging_format,
|
||||
datefmt = '%Y-%m-%d %H:%M:%S',
|
||||
handlers = handlers
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue