1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-28 13:15:25 +00:00

Fix unreadable wtfnode output

This commit is contained in:
Asher 2021-02-12 13:41:45 -06:00 committed by Joe Previte
parent 6d4f814f84
commit ef7e7271b6
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24

View File

@ -1,7 +1,23 @@
import * as util from "util"
import * as wtfnode from "wtfnode"
// Jest seems to hijack console.log in a way that makes the output difficult to
// read. So we'll write directly to process.stderr instead.
const write = (...args: [any, ...any]) => {
if (args.length > 0) {
process.stderr.write(util.format(...args) + "\n")
}
}
wtfnode.setLogger("info", write)
wtfnode.setLogger("warn", write)
wtfnode.setLogger("error", write)
let active = false
/**
* Start logging open handles periodically. This can be used to see what is
* hanging open if anything.
*/
export function setup(): void {
if (active) {
return