Skip to content
This repository was archived by the owner on Sep 2, 2020. It is now read-only.

Commit 0466f50

Browse files
committed
use a raw string pathname instead of URL
1 parent 935b296 commit 0466f50

File tree

1 file changed

+7
-11
lines changed
  • packages/graphql-language-service-server/src

1 file changed

+7
-11
lines changed

packages/graphql-language-service-server/src/Logger.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ import type {Logger as VSCodeLogger} from 'vscode-jsonrpc';
1212

1313
import fs from 'fs';
1414
import os from 'os';
15-
import path from 'path';
16-
import {URL} from 'url';
15+
import {join} from 'path';
1716

1817
const SEVERITY = {
1918
ERROR: 'ERROR',
@@ -23,11 +22,11 @@ const SEVERITY = {
2322
};
2423

2524
export class Logger implements VSCodeLogger {
26-
_logFilePath: URL;
25+
_logFilePath: string;
2726
_stream: ?fs.WriteStream;
2827

2928
constructor(): void {
30-
const dir = path.join(os.tmpdir(), 'graphql-language-service-logs');
29+
const dir = join(os.tmpdir(), 'graphql-language-service-logs');
3130
try {
3231
if (!fs.existsSync(dir)) {
3332
fs.mkdirSync(dir);
@@ -37,12 +36,9 @@ export class Logger implements VSCodeLogger {
3736
// the necessary setup cannot be completed for logger.
3837
}
3938

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`,
4642
);
4743

4844
this._stream = null;
@@ -71,7 +67,7 @@ export class Logger implements VSCodeLogger {
7167

7268
const logMessage = `${timestamp} [${severity}] (pid: ${pid}) graphql-language-service-usage-logs: ${message}\n\n`;
7369
// write to the file in tmpdir
74-
fs.appendFile(this._logFilePath.pathname, logMessage, error => {});
70+
fs.appendFile(this._logFilePath, logMessage, error => {});
7571
}
7672
}
7773

0 commit comments

Comments
 (0)