Mistakes and nullchecks

Doesn't javascript support
`a?.b?.c`?
This commit is contained in:
Cristian Le 2021-07-30 16:54:50 +09:00
parent b575dba30d
commit 4e639ee2ff
1 changed files with 8 additions and 6 deletions

View File

@ -17,7 +17,7 @@ import process from "process"
import fs from "fs"
import sd from "systemd-daemon"
import logger from "loglevel"
import loggerprefix from "loglevel"
import loggerprefix from "loglevel-plugin-prefix"
import arg from "arg"
@ -44,13 +44,15 @@ MessagesPuppeteer.extensionDir = config.extension_dir || MessagesPuppeteer.exten
MessagesPuppeteer.cycleDelay = config.cycle_delay || MessagesPuppeteer.cycleDelay
MessagesPuppeteer.useXdotool = config.use_xdotool || MessagesPuppeteer.useXdotool
MessagesPuppeteer.jiggleDelay = config.jiggle_delay || MessagesPuppeteer.jiggleDelay
logger.setLevel(config.logger.default_level || 3)
logger.getLogger("Puppeteer").setLevel(config.logger.puppeteer.level || logger.getLevel())
logger.getLogger("Puppeteer_details").setLevel(config.logger.puppeteer.details || 3)
logger.getLogger("Puppeteer_spammer").setLevel(config.logger.puppeteer.spammer || 3)
let clog = config.logger
let clogpup = clog ? clog.puppeteer : undefined
logger.setLevel(clog ? clog.default_level || 3 : 3)
logger.getLogger("Puppeteer").setLevel(clogpup ? clogpup.level : logger.getLevel())
logger.getLogger("Puppeteer_details").setLevel(clogpup ? clogpup.details : 3)
logger.getLogger("Puppeteer_spammer").setLevel(clogpup ? clogpup.spammer : 3)
// Register and specify the logger format. Others will inherit
loggerprefix.reg(logger)
loggerprefix.apply(logger, { template: '[%n] %l:' });
loggerprefix.apply(logger, {template: '[%n] %l:'});
const api = new PuppetAPI(config.listen)