@@ -12,8 +12,7 @@ import type {Logger as VSCodeLogger} from 'vscode-jsonrpc';
12
12
13
13
import fs from 'fs' ;
14
14
import os from 'os' ;
15
- import path from 'path' ;
16
- import { URL } from 'url' ;
15
+ import { join } from 'path' ;
17
16
18
17
const SEVERITY = {
19
18
ERROR : 'ERROR' ,
@@ -23,11 +22,11 @@ const SEVERITY = {
23
22
} ;
24
23
25
24
export class Logger implements VSCodeLogger {
26
- _logFilePath : URL ;
25
+ _logFilePath : string ;
27
26
_stream : ?fs . WriteStream ;
28
27
29
28
constructor ( ) : void {
30
- const dir = path . join ( os . tmpdir ( ) , 'graphql-language-service-logs' ) ;
29
+ const dir = join ( os . tmpdir ( ) , 'graphql-language-service-logs' ) ;
31
30
try {
32
31
if ( ! fs . existsSync ( dir ) ) {
33
32
fs . mkdirSync ( dir ) ;
@@ -37,12 +36,9 @@ export class Logger implements VSCodeLogger {
37
36
// the necessary setup cannot be completed for logger.
38
37
}
39
38
40
- this . _logFilePath = new URL (
41
- path . join (
42
- dir ,
43
- `graphql-language-service-log-${ os . userInfo ( ) . username } -${ getDateString ( ) } .log` ,
44
- ) ,
45
- 'file://' ,
39
+ this . _logFilePath = join (
40
+ dir ,
41
+ `graphql-language-service-log-${ os . userInfo ( ) . username } -${ getDateString ( ) } .log` ,
46
42
) ;
47
43
48
44
this . _stream = null ;
@@ -71,7 +67,7 @@ export class Logger implements VSCodeLogger {
71
67
72
68
const logMessage = `${ timestamp } [${ severity } ] (pid: ${ pid } ) graphql-language-service-usage-logs: ${ message } \n\n` ;
73
69
// write to the file in tmpdir
74
- fs . appendFile ( this . _logFilePath . pathname , logMessage , error => { } ) ;
70
+ fs . appendFile ( this . _logFilePath , logMessage , error => { } ) ;
75
71
}
76
72
}
77
73
0 commit comments