mirror of
https://github.com/FlareSolverr/FlareSolverr.git
synced 2026-05-01 03:55:35 +02:00
Backport changes from Cloudproxy (#11)
This commit is contained in:
19
src/log.ts
Normal file
19
src/log.ts
Normal 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}`
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user