Backport changes from Cloudproxy (#11)

This commit is contained in:
Alexandre Beloin
2020-12-12 17:09:03 -05:00
committed by GitHub
parent 5ed7c09160
commit a422756ae6
18 changed files with 3918 additions and 322 deletions

19
src/log.ts Normal file
View File

@@ -0,0 +1,19 @@
let requests = 0
const LOG_HTML: boolean = Boolean(process.env.LOG_HTML) || false
export default {
incRequests: () => { requests++ },
html(html: string) {
if (LOG_HTML)
this.debug(html)
},
...require('console-log-level')(
{
level: process.env.LOG_LEVEL || 'debug',
prefix(level: string) {
return `${new Date().toISOString()} ${level.toUpperCase()} REQ-${requests}`
}
}
)
}