Adds a status printer function

This commit is contained in:
Alicia Sykes 2021-09-12 14:58:56 +01:00
parent c56412188d
commit 21014cf0cd
1 changed files with 19 additions and 2 deletions

View File

@ -1,10 +1,12 @@
/* eslint no-console: ["error", { allow: ["log", "info"] }] */ /* eslint no-console: ["error", { allow: ["log", "info"] }] */
/* Prints the app name and version, helpful for debugging */
export const welcomeMsg = () => { export const welcomeMsg = () => {
const v = process.env.VUE_APP_VERSION ? `V${process.env.VUE_APP_VERSION}` : ''; const v = process.env.VUE_APP_VERSION ? `V${process.env.VUE_APP_VERSION}` : '';
console.log(`\n%cDashy ${v} 🚀`, 'color:#0dd8d8; background:#0b1021; font-size:1.5rem; padding:0.15rem 0.25rem; margin: 1rem auto; font-family: Rockwell; border: 2px solid #0dd8d8; border-radius: 4px;font-weight: bold; text-shadow: 1px 1px 1px #00af87bf;'); console.log(`\n%cDashy ${v} 🚀`, 'color:#0dd8d8; background:#0b1021; font-size:1.5rem; padding:0.15rem 0.25rem; margin: 1rem auto; font-family: Rockwell; border: 2px solid #0dd8d8; border-radius: 4px;font-weight: bold; text-shadow: 1px 1px 1px #00af87bf;');
}; };
/* Prints warning message, usually when there is a configuration error */
export const warningMsg = (message) => { export const warningMsg = (message) => {
console.info( console.info(
`\n%c⚠ Warning ⚠️%c \n${message} \n\n%cThis is likely not an issue with Dashy, but rather your configuration. If you think it is a bug, please open a ticket on GitHub: https://git.io/JukXk`, `\n%c⚠ Warning ⚠️%c \n${message} \n\n%cThis is likely not an issue with Dashy, but rather your configuration. If you think it is a bug, please open a ticket on GitHub: https://git.io/JukXk`,
@ -14,6 +16,21 @@ export const warningMsg = (message) => {
); );
}; };
export const raiseBug = () => { /* Prints status message */
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;"); export const statusMsg = (title, msg) => {
console.log(
`%c${title || ''}\n%c${msg}`,
'font-weight: bold; color: #0dd8d8; text-decoration: underline;',
'color: #ceb73f;',
);
};
/* Prints status message, with a stack trace */
export const statusErrorMsg = (title, msg, errorLog) => {
console.log(
`%c${title || ''}\n%c${msg} \n%c${errorLog}`,
'font-weight: bold; color: #0dd8d8; text-decoration: underline;',
'color: #ff025a',
'color: #ff025a80;',
);
}; };