`require` does not work?

This commit is contained in:
Cristian Le 2021-07-30 17:45:11 +09:00
parent 3fdb6cc8d3
commit a477d10d29
2 changed files with 3 additions and 2 deletions

View File

@ -16,6 +16,7 @@
import net from "net" import net from "net"
import fs from "fs" import fs from "fs"
import path from "path" import path from "path"
import logger from "loglevel";
import Client from "./client.js" import Client from "./client.js"
import { promisify } from "./util.js" import { promisify } from "./util.js"
@ -29,7 +30,7 @@ export default class PuppetAPI {
this.clients = new Map() this.clients = new Map()
this.connIDSequence = 0 this.connIDSequence = 0
this.stopped = false this.stopped = false
this.log = require("loglevel").getLogger("API") this.log = logger.getLogger("API")
} }
acceptConnection = sock => { acceptConnection = sock => {

View File

@ -35,7 +35,7 @@ export default class Client {
this.maxCommandID = 0 this.maxCommandID = 0
this.set_userID(userID) this.set_userID(userID)
if (!this.userID) { if (!this.userID) {
this.log = require("loglevel").getLogger(`API/${this.connID}`) this.log = logger.getLogger(`API/${this.connID}`)
this.log.setLevel(logger.getLogger("API").getLevel()) this.log.setLevel(logger.getLogger("API").getLevel())
} }
} }