mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-27 04:58:42 +02:00
fixing formatting of traceback
This commit is contained in:
parent
8de354f31e
commit
001cb2273b
2 changed files with 7 additions and 3 deletions
|
@ -25,6 +25,7 @@ from typing import Final
|
||||||
from botocore.config import Config
|
from botocore.config import Config
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import traceback
|
||||||
from django.utils.log import ServerFormatter
|
from django.utils.log import ServerFormatter
|
||||||
|
|
||||||
# # # ###
|
# # # ###
|
||||||
|
@ -471,7 +472,11 @@ class JsonFormatter(logging.Formatter):
|
||||||
"lineno": record.lineno,
|
"lineno": record.lineno,
|
||||||
"message": record.getMessage(),
|
"message": record.getMessage(),
|
||||||
}
|
}
|
||||||
return json.dumps(log_record)
|
# Capture exception info if it exists
|
||||||
|
if record.exc_info:
|
||||||
|
log_record["exception"] = "".join(traceback.format_exception(*record.exc_info))
|
||||||
|
|
||||||
|
return json.dumps(log_record, ensure_ascii=False)
|
||||||
|
|
||||||
|
|
||||||
class JsonServerFormatter(ServerFormatter):
|
class JsonServerFormatter(ServerFormatter):
|
||||||
|
|
|
@ -3,7 +3,6 @@ from django.db import IntegrityError
|
||||||
from registrar.models import PortfolioInvitation, User, UserPortfolioPermission
|
from registrar.models import PortfolioInvitation, User, UserPortfolioPermission
|
||||||
from registrar.utility.email import EmailSendingError
|
from registrar.utility.email import EmailSendingError
|
||||||
import logging
|
import logging
|
||||||
import traceback
|
|
||||||
from registrar.utility.errors import (
|
from registrar.utility.errors import (
|
||||||
AlreadyDomainInvitedError,
|
AlreadyDomainInvitedError,
|
||||||
AlreadyDomainManagerError,
|
AlreadyDomainManagerError,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue