beautify code

This commit is contained in:
Daniel Sommer 2022-03-25 12:37:06 +01:00
parent 5269d17324
commit b0c55b9e86
4 changed files with 19 additions and 22 deletions

View file

@ -63,7 +63,7 @@ async function setPedalStatus(pedal) {
global.config.blinky.port,
'set',
{
blinkstick: "strip",
blinkstick: 'strip',
index: pedal.id,
color: getPedalColor(pedal.name, isBypassActive(bypass))
}

View file

@ -34,12 +34,12 @@ exports.API_BYPASS_BY_ID = BYPASS + '/' + VARIABLE_ID;
exports.API_MIDI = MIDI;
exports.API_SYSTEMD = SYSTEMD;
exports.CACHE_BANKS = "banks";
exports.CACHE_PEDALBOARDS = "pedalboards";
exports.CACHE_PEDALBOARD_DEFAULT = "pedalboard_default";
exports.CACHE_PEDALBOARD_CURRENT = "pedalboard_current";
exports.CACHE_PEDALS = "pedals";
exports.CACHE_PEDALS_BYPASSED = "pedals_bypassed"
exports.CACHE_BANKS = 'banks';
exports.CACHE_PEDALBOARDS = 'pedalboards';
exports.CACHE_PEDALBOARD_DEFAULT = 'pedalboard_default';
exports.CACHE_PEDALBOARD_CURRENT = 'pedalboard_current';
exports.CACHE_PEDALS = 'pedals';
exports.CACHE_PEDALS_BYPASSED = 'pedals_bypassed'
exports.PEDALBOARD_DEFAULT = '/var/modep/pedalboards/default.pedalboard';

View file

@ -54,7 +54,7 @@ function getMemoryInfo() {
async function getTemperature() {
try {
return commands.execute("vcgencmd", ["measure_temp"]);
return commands.execute('vcgencmd', ['measure_temp']);
} catch (err) {
throw new Error(err);
}

View file

@ -13,20 +13,17 @@ const LOGLEVEL_ERROR = 3;
var loglevel = getLogLevel();
var timestamp = getTimestamp();
function initialize() {
return new Promise((resolve, reject) => {
if (global.config == undefined) {
reject('could not initialize logger, config is undefined');
async function initialize() {
if (global.config === undefined) {
throw new Error('could not initialize logger, config is undefined');
}
loglevel = getLogLevel();
timestamp = getTimestamp();
resolve();
});
}
// get the loglevel
function getLogLevel() {
if (global.config?.log?.level == undefined) {
if (global.config?.log?.level === undefined) {
return LOGLEVEL_INFO;
}
switch (global.config.log.level) {
@ -49,15 +46,15 @@ function getLogLevel() {
// get the timestamp format
function getTimestamp() {
if (global.config?.log?.format != undefined) {
return global.config.log.format;
if (global.config?.log?.format === undefined) {
return 'DD.MM.YYYY HH:mm:ss:SS';
}
return "DD.MM.YYYY HH:mm:ss:SS";
return global.config.log.format;
}
// log a http request - response object
function http(object) {
if (object == undefined) {
if (object === undefined) {
return;
}
let message = '[' + object.request.method + ':' + object.code + '] url: \'' + object.request.url + '\'';