fix exception logging
This commit is contained in:
parent
276102543f
commit
4973af2b07
|
|
@ -25,6 +25,7 @@ def log_error(
|
|||
error_data: Optional[str] = None,
|
||||
scope: Optional[str] = None,
|
||||
plugin: Optional[str] = None,
|
||||
user_id: Optional[int] = None,
|
||||
):
|
||||
"""Log an error to the database.
|
||||
|
||||
|
|
@ -37,6 +38,7 @@ def log_error(
|
|||
error_data: The error data (optional, overrides 'data')
|
||||
scope: The scope of the error (optional)
|
||||
plugin: The plugin name associated with this error (optional)
|
||||
user_id: The user ID associated with this error (optional)
|
||||
"""
|
||||
import InvenTree.ready
|
||||
|
||||
|
|
@ -71,6 +73,9 @@ def log_error(
|
|||
except AttributeError:
|
||||
data = 'No traceback information available'
|
||||
|
||||
if user_id:
|
||||
data = f'User ID: {user_id}\n{data}'
|
||||
|
||||
# Log error to stderr
|
||||
logger.error(info)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue