nicer logs in server

This commit is contained in:
Tommy D. Rossi
2025-11-21 23:15:51 +01:00
parent 35dbcab181
commit 75f9e6d79f
+2 -1
View File
@@ -2,6 +2,7 @@ import { startPlayWriterCDPRelayServer } from './extension/cdp-relay.js'
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import util from 'node:util'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const logFilePath = path.join(__dirname, '..', 'relay-server.log')
@@ -10,7 +11,7 @@ fs.writeFileSync(logFilePath, '')
const log = (...args: any[]) => {
const message = args.map(arg =>
typeof arg === 'string' ? arg : JSON.stringify(arg)
typeof arg === 'string' ? arg : util.inspect(arg, { depth: null, colors: false })
).join(' ')
fs.appendFileSync(logFilePath, message + '\n')
}