Better Logging

This commit is contained in:
Dinhero21 2024-01-18 10:28:26 -03:00
parent 70d885c922
commit 42c6ad8822
2 changed files with 14 additions and 0 deletions

View file

@ -12,6 +12,8 @@ export const server = createServer({
})
server.on('login', client => {
console.info(`${client.username} has connected!`)
// eslint-disable-next-line no-new
new Instance(client)
})

View file

@ -37,9 +37,21 @@ export class Instance {
console.error('Target error:', error)
})
console.info('Initializing worker... (local context)')
const start = performance.now()
const worker = new Worker(WORKER_PATH)
this.worker = worker
worker.on('online', () => {
const end = performance.now()
const delta = end - start
console.info(`Worker online! took ${delta.toFixed(2)}ms`)
})
worker.on('error', error => {
console.error('Worker error:', error)
})