Add logger functions and move player functions to feature

This commit is contained in:
jeffvli 2024-02-12 13:58:50 -08:00
parent adf5fc348a
commit 69f82a9427
3 changed files with 197 additions and 143 deletions

View file

@ -2,6 +2,7 @@
import path from 'path';
import process from 'process';
import { URL } from 'url';
import log from 'electron-log/main';
export let resolveHtmlPath: (htmlFileName: string) => string;
@ -50,3 +51,19 @@ export const hotkeyToElectronAccelerator = (hotkey: string) => {
return accelerator;
};
const logInstance = {
debug: log.debug,
error: log.error,
info: log.info,
success: log.info,
verbose: log.verbose,
warning: log.warn,
};
export const createLog = (data: {
message: string;
type: 'debug' | 'verbose' | 'success' | 'error' | 'warning' | 'info';
}) => {
logInstance[data.type](data.message);
};