Skip to content

Commit

Permalink
remove unnecessary logs for LS
Browse files Browse the repository at this point in the history
  • Loading branch information
nighca committed Jan 23, 2025
1 parent bdebe1e commit e401e00
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions tools/spxls/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ export class Spxlc {
*/
request<T>(method: string, params?: any): Promise<T> {
const id = this.nextRequestId++
/* eslint-disable no-console */
// TODO: remove debug logs https://github.com/goplus/builder/issues/1255
console.debug(`[${id}][${method}] params:`, params)
const sendAt = Date.now()
const sendAt = performance.now()
return new Promise<T>((resolve, reject) => {
const message: RequestMessage = {
jsonrpc: '2.0',
Expand All @@ -94,15 +91,14 @@ export class Spxlc {
}
}).then(
result => {
const time = Date.now() - sendAt
console.debug(`[${id}][${method}] took ${time}ms`)
console.debug(`[${id}][${method}] result:`, result)
if (process.env.NODE_ENV === 'development') {
const time = performance.now() - sendAt
if (time > 50) console.warn(`[LSP] ${method} took ${Math.round(time)}ms, params:`, params)
}
return result
},
err => {
const time = Date.now() - sendAt
console.debug(`[${id}][${method}] took ${time}ms`)
console.debug(`[${id}][${method}] error:`, err)
console.warn(`[LSP] ${method} error:`, err, ', params:', params)
throw err
}
)
Expand Down

0 comments on commit e401e00

Please sign in to comment.