diff --git a/src/utils/CoolConsole.js b/src/utils/CoolConsole.js index 4bd32bd6..c5641c20 100644 --- a/src/utils/CoolConsole.js +++ b/src/utils/CoolConsole.js @@ -1,14 +1,19 @@ -/* eslint no-console: ["error", { allow: ["log"] }] */ +/* eslint no-console: ["error", { allow: ["log", "info"] }] */ export const welcomeMsg = () => { const v = process.env.VUE_APP_VERSION ? `V${process.env.VUE_APP_VERSION}` : ''; - console.log(`%cDashy ${v} 🚀`, 'color:#00af87; background:#0b1021; font-size:36px; padding: 0.5rem 0.5rem 0; margin: 1rem auto; font-family: Rockwell; border: 2px solid #00af87; border-radius: 4px;font-weight: bold; text-shadow: 1px 1px 1px #00af87bf;'); + console.log(`%cDashy ${v} 🚀`, 'color:#00af87; background:#0b1021; font-size:1.5rem; padding: 0 0.5rem 0; margin: 1rem auto; font-family: Rockwell; border: 2px solid #00af87; border-radius: 4px;font-weight: bold; text-shadow: 1px 1px 1px #00af87bf;'); }; -export const warningMsg = () => { - console.log('%c⚠️ Error ⚠️', "background:#21bbca; color:#0b1021; font-size:20px; padding:0.25rem 0.5rem; margin: 1rem auto 0.25rem; font-family: 'Trebuchet MS', Helvetica; border: 2px solid yellow; border-radius: 4px; font-weight: bold;"); +export const warningMsg = (message) => { + console.info( + `%c⚠️ Warning ⚠️%c \n${message} \n\n%c🐛If you have found a bug, please open a ticket on GitHub, at: https://git.io/JukXk`, + "color:#ceb73f; background: #ceb73f33; font-size:1.2rem; padding:0.15rem; margin: 0.2rem auto 1rem auto; font-family: Rockwell, Tahoma, 'Trebuchet MS', Helvetica; border: 2px solid #ceb73f; border-radius: 4px; font-weight: bold; text-shadow: 1px 1px 1px #000000bf;", + 'font-weight: bold; font-size: 0.9rem;color: #ceb73f;', + "color: #ceb73f; font-size: 0.6rem; font-family: Tahoma, 'Trebuchet MS', Helvetica;", + ); }; export const raiseBug = () => { - console.log('%c🐛If you have found a bug, raise an issue on GitHub, at:\nhttps://git.io/JnqPR', "color:#dddd10; font-size: 14px; font-family: 'Trebuchet MS', Helvetica;"); + console.log('%c🐛If you have found a bug, raise an issue on GitHub, at:\nhttps://git.io/JukXk', "color:#dddd10; font-size: 14px; font-family: 'Trebuchet MS', Helvetica;"); }; diff --git a/src/utils/ErrorHandler.js b/src/utils/ErrorHandler.js index eb37160b..8406d6a6 100644 --- a/src/utils/ErrorHandler.js +++ b/src/utils/ErrorHandler.js @@ -1,15 +1,14 @@ /* eslint no-console: ["error", { allow: ["warn", "error"] }] */ - -import { warningMsg, raiseBug } from '@/utils/CoolConsole'; +import * as Sentry from '@sentry/vue'; +import { warningMsg } from '@/utils/CoolConsole'; /** * Function called when an error happens * If you wish to use an error logging service, put code for it here */ const ErrorHandler = function handler(msg) { - warningMsg(); - console.warn(msg); - raiseBug(); + warningMsg(msg); + Sentry.captureMessage(msg); }; export default ErrorHandler; diff --git a/src/utils/ErrorReporting.js b/src/utils/ErrorReporting.js index c79c5834..77cea661 100644 --- a/src/utils/ErrorReporting.js +++ b/src/utils/ErrorReporting.js @@ -12,11 +12,13 @@ import ConfigAccumulator from '@/utils/ConfigAccumalator'; import { sentryDsn } from '@/utils/defaults'; -const ErrorTracking = (Vue, router) => { +const ErrorReporting = (Vue, router) => { // Fetch users config const appConfig = new ConfigAccumulator().appConfig() || {}; // Check if error reporting is enabled. Only proceed if user has turned it on. if (appConfig.enableErrorReporting) { + // Get current app version + const appVersion = process.env.VUE_APP_VERSION ? `Dashy@${process.env.VUE_APP_VERSION}` : ''; // Import Sentry const Sentry = require('@sentry/vue'); const { Integrations } = require('@sentry/tracing'); @@ -32,10 +34,11 @@ const ErrorTracking = (Vue, router) => { }), ], tracesSampleRate: 1.0, + release: appVersion, }); } else { - // Error reporting not enabled. Do Nothing. + // Error reporting has not been enabled by the user. Do Nothing. } }; -export default ErrorTracking; +export default ErrorReporting;