mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-26 04:28:39 +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
|
||||
import json
|
||||
import logging
|
||||
import traceback
|
||||
from django.utils.log import ServerFormatter
|
||||
|
||||
# # # ###
|
||||
|
@ -471,7 +472,11 @@ class JsonFormatter(logging.Formatter):
|
|||
"lineno": record.lineno,
|
||||
"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):
|
||||
|
|
|
@ -3,7 +3,6 @@ from django.db import IntegrityError
|
|||
from registrar.models import PortfolioInvitation, User, UserPortfolioPermission
|
||||
from registrar.utility.email import EmailSendingError
|
||||
import logging
|
||||
import traceback
|
||||
from registrar.utility.errors import (
|
||||
AlreadyDomainInvitedError,
|
||||
AlreadyDomainManagerError,
|
||||
|
@ -11,7 +10,7 @@ from registrar.utility.errors import (
|
|||
OutsideOrgMemberError,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# These methods are used by multiple views which share similar logic and function
|
||||
# when creating invitations and sending associated emails. These can be reused in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue