Prettified

This commit is contained in:
Leah Schumann 2024-03-05 06:50:07 -05:00
parent 9b7d2c8e81
commit dae9620843
6 changed files with 34 additions and 25 deletions

View file

@ -46,7 +46,7 @@ window.onerror = (msg, url, line, col, error) => {
column: col ?? "", column: col ?? "",
error: error ?? "", error: error ?? "",
}); });
// If you return true, then error alerts (like in older versions of // If you return true, then error alerts (like in older versions of
// Internet Explorer) will be suppressed. // Internet Explorer) will be suppressed.
var suppressErrorAlert = true; var suppressErrorAlert = true;

View file

@ -28,8 +28,7 @@ const applicationConfig = {
YAHOO_CALENDAR: "https://calendar.yahoo.com/?v=60", YAHOO_CALENDAR: "https://calendar.yahoo.com/?v=60",
OUTLOOK_CALENDAR: OUTLOOK_CALENDAR:
"https://outlook.office.com/calendar/deeplink/compose?path=/calendar/action/compose&rru=addevent", "https://outlook.office.com/calendar/deeplink/compose?path=/calendar/action/compose&rru=addevent",
FRONTEND_LOGGER_URL: FRONTEND_LOGGER_URL: process.env.VUE_APP_CONSUMER_CF_DISTRO + "/analytics/api/v1/logging",
process.env.VUE_APP_CONSUMER_CF_DISTRO + "/analytics/api/v1/logging"
}; };
export { applicationConfig }; export { applicationConfig };

View file

@ -100,7 +100,7 @@ export default {
} }
global.$logger.logError(`${method}: ${endpoint}: ${error.message}`, error); global.$logger.logError(`${method}: ${endpoint}: ${error.message}`, error);
return reject(error); return reject(error);
} }
); );

View file

@ -7,11 +7,17 @@ import { headerKeys } from "@/constants/header-keys";
export class Logger { export class Logger {
logInformation(message, details) { logInformation(message, details) {
this.writeLogEntry(loggingEndpointMethods.LOG_INFORMATION, this.formatLogEntry(message, details)); this.writeLogEntry(
loggingEndpointMethods.LOG_INFORMATION,
this.formatLogEntry(message, details)
);
} }
logWarning(message, details) { logWarning(message, details) {
this.writeLogEntry(loggingEndpointMethods.LOG_WARNING, this.formatLogEntry(message, details)); this.writeLogEntry(
loggingEndpointMethods.LOG_WARNING,
this.formatLogEntry(message, details)
);
} }
logError(message, details) { logError(message, details) {
@ -19,17 +25,25 @@ export class Logger {
} }
logCritical(message, details) { logCritical(message, details) {
this.writeLogEntry(loggingEndpointMethods.LOG_CRITICAL, this.formatLogEntry(message, details)); this.writeLogEntry(
loggingEndpointMethods.LOG_CRITICAL,
this.formatLogEntry(message, details)
);
} }
formatLogEntry(message, details) { formatLogEntry(message, details) {
return `Application: ${applicationConfig.APPLICATION_NAME}\n${message}\n${details ? JSON.stringify(details, undefined, 2) : ""}`; return `Application: ${applicationConfig.APPLICATION_NAME}\n${message}\n${
details ? JSON.stringify(details, undefined, 2) : ""
}`;
} }
writeLogEntry(endpoint, logEntry) { writeLogEntry(endpoint, logEntry) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// If running locally or in the Dev environment show the log entries in the console. // If running locally or in the Dev environment show the log entries in the console.
if (applicationConfig.CURRENT_ENVIRONMENT === "Localhost" || applicationConfig.CURRENT_ENVIRONMENT === "Dev") { if (
applicationConfig.CURRENT_ENVIRONMENT === "Localhost" ||
applicationConfig.CURRENT_ENVIRONMENT === "Dev"
) {
console.log(logEntry); console.log(logEntry);
} }

View file

@ -26,7 +26,9 @@ vueApp.mixin(experimentMixin);
// Vue Error Handling // Vue Error Handling
vueApp.config.errorHandler = (err, vm, info) => { vueApp.config.errorHandler = (err, vm, info) => {
global.$logger.logError(`Page Name - ${vm.getPageName()} - ${info}: ${err.message}\n${err.stack}`); global.$logger.logError(
`Page Name - ${vm.getPageName()} - ${info}: ${err.message}\n${err.stack}`
);
}; };
vueApp.mount("#app"); vueApp.mount("#app");

View file

@ -1126,11 +1126,9 @@ export const actions = {
payload: payload, payload: payload,
logApiCall: false, logApiCall: false,
}) })
.then( .then((response) => {
(response) => { return response;
return response; });
}
);
}, },
logCustomEvent( logCustomEvent(
@ -1177,11 +1175,9 @@ export const actions = {
payload: payload, payload: payload,
logApiCall: false, logApiCall: false,
}) })
.then( .then((response) => {
(response) => { return response;
return response; });
}
);
}, },
initializeSession(context, { userId, deviceId, sessionId, userAgent, referrer }) { initializeSession(context, { userId, deviceId, sessionId, userAgent, referrer }) {
var payload = { var payload = {
@ -1202,11 +1198,9 @@ export const actions = {
payload: payload, payload: payload,
logApiCall: false, logApiCall: false,
}) })
.then( .then((response) => {
(response) => { return response;
return response; });
}
);
}, },
// Misc Actions // Misc Actions