beautify code
This commit is contained in:
parent
5269d17324
commit
b0c55b9e86
4 changed files with 19 additions and 22 deletions
|
@ -63,7 +63,7 @@ async function setPedalStatus(pedal) {
|
||||||
global.config.blinky.port,
|
global.config.blinky.port,
|
||||||
'set',
|
'set',
|
||||||
{
|
{
|
||||||
blinkstick: "strip",
|
blinkstick: 'strip',
|
||||||
index: pedal.id,
|
index: pedal.id,
|
||||||
color: getPedalColor(pedal.name, isBypassActive(bypass))
|
color: getPedalColor(pedal.name, isBypassActive(bypass))
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,12 +34,12 @@ exports.API_BYPASS_BY_ID = BYPASS + '/' + VARIABLE_ID;
|
||||||
exports.API_MIDI = MIDI;
|
exports.API_MIDI = MIDI;
|
||||||
exports.API_SYSTEMD = SYSTEMD;
|
exports.API_SYSTEMD = SYSTEMD;
|
||||||
|
|
||||||
exports.CACHE_BANKS = "banks";
|
exports.CACHE_BANKS = 'banks';
|
||||||
exports.CACHE_PEDALBOARDS = "pedalboards";
|
exports.CACHE_PEDALBOARDS = 'pedalboards';
|
||||||
exports.CACHE_PEDALBOARD_DEFAULT = "pedalboard_default";
|
exports.CACHE_PEDALBOARD_DEFAULT = 'pedalboard_default';
|
||||||
exports.CACHE_PEDALBOARD_CURRENT = "pedalboard_current";
|
exports.CACHE_PEDALBOARD_CURRENT = 'pedalboard_current';
|
||||||
exports.CACHE_PEDALS = "pedals";
|
exports.CACHE_PEDALS = 'pedals';
|
||||||
exports.CACHE_PEDALS_BYPASSED = "pedals_bypassed"
|
exports.CACHE_PEDALS_BYPASSED = 'pedals_bypassed'
|
||||||
|
|
||||||
exports.PEDALBOARD_DEFAULT = '/var/modep/pedalboards/default.pedalboard';
|
exports.PEDALBOARD_DEFAULT = '/var/modep/pedalboards/default.pedalboard';
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ function getMemoryInfo() {
|
||||||
|
|
||||||
async function getTemperature() {
|
async function getTemperature() {
|
||||||
try {
|
try {
|
||||||
return commands.execute("vcgencmd", ["measure_temp"]);
|
return commands.execute('vcgencmd', ['measure_temp']);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new Error(err);
|
throw new Error(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,20 +13,17 @@ const LOGLEVEL_ERROR = 3;
|
||||||
var loglevel = getLogLevel();
|
var loglevel = getLogLevel();
|
||||||
var timestamp = getTimestamp();
|
var timestamp = getTimestamp();
|
||||||
|
|
||||||
function initialize() {
|
async function initialize() {
|
||||||
return new Promise((resolve, reject) => {
|
if (global.config === undefined) {
|
||||||
if (global.config == undefined) {
|
throw new Error('could not initialize logger, config is undefined');
|
||||||
reject('could not initialize logger, config is undefined');
|
|
||||||
}
|
}
|
||||||
loglevel = getLogLevel();
|
loglevel = getLogLevel();
|
||||||
timestamp = getTimestamp();
|
timestamp = getTimestamp();
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the loglevel
|
// get the loglevel
|
||||||
function getLogLevel() {
|
function getLogLevel() {
|
||||||
if (global.config?.log?.level == undefined) {
|
if (global.config?.log?.level === undefined) {
|
||||||
return LOGLEVEL_INFO;
|
return LOGLEVEL_INFO;
|
||||||
}
|
}
|
||||||
switch (global.config.log.level) {
|
switch (global.config.log.level) {
|
||||||
|
@ -49,15 +46,15 @@ function getLogLevel() {
|
||||||
|
|
||||||
// get the timestamp format
|
// get the timestamp format
|
||||||
function getTimestamp() {
|
function getTimestamp() {
|
||||||
if (global.config?.log?.format != undefined) {
|
if (global.config?.log?.format === undefined) {
|
||||||
return global.config.log.format;
|
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
|
// log a http request - response object
|
||||||
function http(object) {
|
function http(object) {
|
||||||
if (object == undefined) {
|
if (object === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let message = '[' + object.request.method + ':' + object.code + '] url: \'' + object.request.url + '\'';
|
let message = '[' + object.request.method + ':' + object.code + '] url: \'' + object.request.url + '\'';
|
||||||
|
|
Loading…
Reference in a new issue