mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-13 20:10:07 +02:00
Improve mpv error logging
This commit is contained in:
+29
-2
@@ -52,7 +52,7 @@ export const hotkeyToElectronAccelerator = (hotkey: string) => {
|
||||
return accelerator;
|
||||
};
|
||||
|
||||
const logInstance = {
|
||||
const logMethod = {
|
||||
debug: log.debug,
|
||||
error: log.error,
|
||||
info: log.info,
|
||||
@@ -61,9 +61,36 @@ const logInstance = {
|
||||
warning: log.warn,
|
||||
};
|
||||
|
||||
const logColor = {
|
||||
debug: 'blue',
|
||||
error: 'red',
|
||||
info: 'blue',
|
||||
success: 'green',
|
||||
verbose: 'blue',
|
||||
warning: 'yellow',
|
||||
};
|
||||
|
||||
export const createLog = (data: {
|
||||
message: string;
|
||||
type: 'debug' | 'verbose' | 'success' | 'error' | 'warning' | 'info';
|
||||
}) => {
|
||||
logInstance[data.type](data.message);
|
||||
logMethod[data.type](`%c${data.message}`, `color: ${logColor[data.type]}`);
|
||||
};
|
||||
|
||||
export const autoUpdaterLogInterface = {
|
||||
debug: (message: string) => {
|
||||
createLog({ message: `[SYSTEM] ${message}`, type: 'debug' });
|
||||
},
|
||||
|
||||
error: (message: string) => {
|
||||
createLog({ message: `[SYSTEM] ${message}`, type: 'error' });
|
||||
},
|
||||
|
||||
info: (message: string) => {
|
||||
createLog({ message: `[SYSTEM] ${message}`, type: 'info' });
|
||||
},
|
||||
|
||||
warn: (message: string) => {
|
||||
createLog({ message: `[SYSTEM] ${message}`, type: 'warning' });
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user