Separate the logging #27
|
@ -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 => {
|
||||||
|
|
|
@ -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())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue