Separate the logging #27

Open
lecris wants to merge 6 commits from lecris/matrix-puppeteer-line:logger into testing
1 changed files with 8 additions and 6 deletions
Showing only changes of commit 4e639ee2ff - Show all commits

View File

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