Adding adidtional bailout and error information logging.
This commit is contained in:
parent
39bd638f7f
commit
c4bd1de992
2 changed files with 24 additions and 16 deletions
|
|
@ -33,30 +33,39 @@ export class Logger {
|
|||
|
||||
formatLogEntry(message, details) {
|
||||
let json = '';
|
||||
if (details) {
|
||||
if (details instanceof Error) {
|
||||
json = JSON.stringify(details, Object.getOwnPropertyNames(details), 2);
|
||||
} else {
|
||||
json = JSON.stringify(details, undefined, 2)
|
||||
const store = useMainStore();
|
||||
const sessionKey = getSessionKeyValue();
|
||||
|
||||
try
|
||||
{
|
||||
if (details) {
|
||||
if (details instanceof Error) {
|
||||
json = JSON.stringify(details, Object.getOwnPropertyNames(details), 2);
|
||||
} else {
|
||||
json = JSON.stringify(details, undefined, 2)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
json = `Failed to serialize log details: ${error}`;
|
||||
}
|
||||
|
||||
return `Application: ${applicationConfig.APPLICATION_NAME} \n${message} \n${json}`;
|
||||
return `Application: ${applicationConfig.APPLICATION_NAME}
|
||||
ClientTag: ${store.issConfig?.clientTag}
|
||||
ParentAccountNumber: ${store.issConfig?.parentAccountNumber}
|
||||
ClientName: ${store.issConfig?.clientName}
|
||||
LastPageVisited: ${store.applicationUser?.lastPageVisited}
|
||||
SessionLogSequenceNumber: ${sessionKey}
|
||||
ReferralSequenceNumber: ${store.order?.referralSequenceNumber}
|
||||
ReferralNumber: ${store.order?.referralNumber}
|
||||
EON: ${store.order?.eon}
|
||||
Message: ${message}
|
||||
JSON: ${json}`;
|
||||
}
|
||||
|
||||
writeLogEntry(endpoint, logEntry) {
|
||||
const store = useMainStore();
|
||||
const sessionKey = getSessionKeyValue();
|
||||
|
||||
// TODO: Work in progress.
|
||||
/*
|
||||
if ( store.applicationUser.logErrorCalls> 10 ) {
|
||||
console.error("Exceeded maximum log error calls for this session. Further logging will be suppressed to prevent potential infinite loops.");
|
||||
return;
|
||||
}
|
||||
|
||||
store.applicationUser.logErrorCalls += 1;
|
||||
*/
|
||||
return new Promise((resolve, reject) => {
|
||||
// If running locally or in the Dev environment show the log entries in the console.
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -245,7 +245,6 @@ export const getDefaultState = () => ({
|
|||
duplicateOrders: [],
|
||||
hasSentSaveQuoteEmail: null,
|
||||
coverageLookupAttempts: 0,
|
||||
//logErrorCalls: 0,
|
||||
firstHit: true
|
||||
},
|
||||
issConfig: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue