Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d8cacdc1
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d8cacdc1
编写于
12月 05, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix spdlog service not closing file handle on reload
related to #39659
上级
65cd8439
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
32 addition
and
9 deletion
+32
-9
package.json
package.json
+2
-2
src/typings/spdlog.d.ts
src/typings/spdlog.d.ts
+1
-0
src/vs/code/electron-browser/sharedProcessMain.ts
src/vs/code/electron-browser/sharedProcessMain.ts
+1
-0
src/vs/code/electron-main/main.ts
src/vs/code/electron-main/main.ts
+2
-0
src/vs/platform/log/common/log.ts
src/vs/platform/log/common/log.ts
+13
-1
src/vs/platform/log/node/spdlogService.ts
src/vs/platform/log/node/spdlogService.ts
+2
-3
src/vs/workbench/electron-browser/shell.ts
src/vs/workbench/electron-browser/shell.ts
+2
-0
src/vs/workbench/node/extensionHostMain.ts
src/vs/workbench/node/extensionHostMain.ts
+6
-0
yarn.lock
yarn.lock
+3
-3
未找到文件。
package.json
浏览文件 @
d8cacdc1
...
...
@@ -37,7 +37,7 @@
"
node-pty
"
:
"
0.7.3
"
,
"
nsfw
"
:
"
1.0.16
"
,
"
semver
"
:
"
4.3.6
"
,
"
spdlog
"
:
"
0.
2.1
"
,
"
spdlog
"
:
"
0.
3.0
"
,
"
v8-inspect-profiler
"
:
"
^0.0.6
"
,
"
vscode-chokidar
"
:
"
1.6.2
"
,
"
vscode-debugprotocol
"
:
"
1.25.0
"
,
...
...
src/typings/spdlog.d.ts
浏览文件 @
d8cacdc1
...
...
@@ -29,5 +29,6 @@ declare module 'spdlog' {
critical
(
message
:
string
);
setLevel
(
level
:
number
);
flush
():
void
;
drop
():
void
;
}
}
\ No newline at end of file
src/vs/code/electron-browser/sharedProcessMain.ts
浏览文件 @
d8cacdc1
...
...
@@ -80,6 +80,7 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
const
environmentService
=
new
EnvironmentService
(
initData
.
args
,
process
.
execPath
);
const
logService
=
new
SpdLogService
(
'
sharedprocess
'
,
environmentService
);
process
.
once
(
'
exit
'
,
()
=>
logService
.
dispose
());
registerGlobalLogService
(
logService
);
logService
.
info
(
'
main
'
,
JSON
.
stringify
(
configuration
));
...
...
src/vs/code/electron-main/main.ts
浏览文件 @
d8cacdc1
...
...
@@ -51,7 +51,9 @@ function createServices(args: ParsedArgs): IInstantiationService {
const
spdlogService
=
new
SpdLogService
(
'
main
'
,
environmentService
);
const
legacyLogService
=
new
LegacyLogMainService
(
environmentService
);
const
logService
=
new
MultiplexLogService
([
legacyLogService
,
spdlogService
]);
registerGlobalLogService
(
logService
);
process
.
once
(
'
exit
'
,
()
=>
logService
.
dispose
());
// Eventually cleanup
setTimeout
(()
=>
spdlogService
.
cleanup
().
then
(
null
,
err
=>
console
.
error
(
err
)),
10000
);
...
...
src/vs/platform/log/common/log.ts
浏览文件 @
d8cacdc1
...
...
@@ -8,6 +8,7 @@
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
createDecorator
as
createServiceDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
createDecorator
}
from
'
vs/base/common/decorators
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
export
const
ILogService
=
createServiceDecorator
<
ILogService
>
(
'
logService
'
);
...
...
@@ -21,7 +22,7 @@ export enum LogLevel {
Off
}
export
interface
ILogService
{
export
interface
ILogService
extends
IDisposable
{
_serviceBrand
:
any
;
setLevel
(
level
:
LogLevel
):
void
;
...
...
@@ -81,6 +82,10 @@ export class LegacyLogMainService implements ILogService {
console
.
error
(
`\x1b[90m[main
${
new
Date
().
toLocaleTimeString
()}
]\x1b[0m`
,
message
,
...
args
);
}
}
dispose
():
void
{
// noop
}
}
export
class
MultiplexLogService
implements
ILogService
{
...
...
@@ -129,6 +134,12 @@ export class MultiplexLogService implements ILogService {
logService
.
critical
(
message
,
...
args
);
}
}
dispose
():
void
{
for
(
const
logService
of
this
.
logServices
)
{
logService
.
dispose
();
}
}
}
export
class
NoopLogService
implements
ILogService
{
...
...
@@ -140,6 +151,7 @@ export class NoopLogService implements ILogService {
warn
(
message
:
string
,
...
args
:
any
[]):
void
{
}
error
(
message
:
string
|
Error
,
...
args
:
any
[]):
void
{
}
critical
(
message
:
string
|
Error
,
...
args
:
any
[]):
void
{
}
dispose
():
void
{
}
}
let
globalLogService
:
ILogService
=
new
NoopLogService
();
...
...
src/vs/platform/log/node/spdlogService.ts
浏览文件 @
d8cacdc1
...
...
@@ -10,7 +10,6 @@ import { ILogService, LogLevel } from 'vs/platform/log/common/log';
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
RotatingLogger
,
setAsyncMode
}
from
'
spdlog
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
fromNodeEventEmitter
}
from
'
vs/base/common/event
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
readdir
,
rimraf
}
from
'
vs/base/node/pfs
'
;
...
...
@@ -30,8 +29,6 @@ export class SpdLogService implements ILogService {
const
logfilePath
=
path
.
join
(
environmentService
.
logsPath
,
`
${
processName
}
.log`
);
this
.
logger
=
new
RotatingLogger
(
processName
,
logfilePath
,
1024
*
1024
*
5
,
6
);
this
.
setLevel
(
environmentService
.
logLevel
);
fromNodeEventEmitter
(
process
,
'
exit
'
)(()
=>
this
.
logger
.
flush
(),
null
,
this
.
disposables
);
}
/**
...
...
@@ -79,6 +76,8 @@ export class SpdLogService implements ILogService {
}
dispose
():
void
{
this
.
logger
.
flush
();
this
.
logger
.
drop
();
this
.
disposables
=
dispose
(
this
.
disposables
);
}
...
...
src/vs/workbench/electron-browser/shell.ts
浏览文件 @
d8cacdc1
...
...
@@ -287,6 +287,8 @@ export class WorkbenchShell {
serviceCollection
.
set
(
IConfigurationService
,
this
.
configurationService
);
serviceCollection
.
set
(
IEnvironmentService
,
this
.
environmentService
);
serviceCollection
.
set
(
ILogService
,
this
.
logService
);
disposables
.
push
(
this
.
logService
);
serviceCollection
.
set
(
ITimerService
,
this
.
timerService
);
serviceCollection
.
set
(
IStorageService
,
this
.
storageService
);
this
.
mainProcessServices
.
forEach
((
serviceIdentifier
,
serviceInstance
)
=>
{
...
...
src/vs/workbench/node/extensionHostMain.ts
浏览文件 @
d8cacdc1
...
...
@@ -25,6 +25,7 @@ import { ExtensionActivatedByEvent } from 'vs/workbench/api/node/extHostExtensio
import
{
EnvironmentService
}
from
'
vs/platform/environment/node/environmentService
'
;
import
{
SpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
registerGlobalLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
// const nativeExit = process.exit.bind(process);
function
patchProcess
(
allowExit
:
boolean
)
{
...
...
@@ -76,6 +77,7 @@ export class ExtensionHostMain {
private
_environment
:
IEnvironment
;
private
_extensionService
:
ExtHostExtensionService
;
private
_extHostConfiguration
:
ExtHostConfiguration
;
private
disposables
:
IDisposable
[]
=
[];
constructor
(
rpcProtocol
:
RPCProtocol
,
initData
:
IInitData
)
{
this
.
_environment
=
initData
.
environment
;
...
...
@@ -89,7 +91,9 @@ export class ExtensionHostMain {
const
extHostWorkspace
=
new
ExtHostWorkspace
(
threadService
,
initData
.
workspace
);
const
environmentService
=
new
EnvironmentService
(
initData
.
args
,
initData
.
execPath
);
const
logService
=
new
SpdLogService
(
`exthost
${
initData
.
windowId
}
`
,
environmentService
);
registerGlobalLogService
(
logService
);
this
.
disposables
.
push
(
logService
);
logService
.
info
(
'
main {0}
'
,
initData
);
...
...
@@ -146,6 +150,8 @@ export class ExtensionHostMain {
}
this
.
_isTerminating
=
true
;
this
.
disposables
=
dispose
(
this
.
disposables
);
errors
.
setUnexpectedErrorHandler
((
err
)
=>
{
// TODO: write to log once we have one
});
...
...
yarn.lock
浏览文件 @
d8cacdc1
...
...
@@ -5038,9 +5038,9 @@ sparkles@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/sparkles/-/sparkles-1.0.0.tgz#1acbbfb592436d10bbe8f785b7cc6f82815012c3"
spdlog@0.
2.1
:
version "0.
2.1
"
resolved "https://registry.yarnpkg.com/spdlog/-/spdlog-0.
2.1.tgz#1a9de952ccffe9b9227dd20306aca7e428621fa1
"
spdlog@0.
3.0
:
version "0.
3.0
"
resolved "https://registry.yarnpkg.com/spdlog/-/spdlog-0.
3.0.tgz#8fc0dfa407ccb97854bd026beb91267adeed5cf3
"
dependencies:
bindings "^1.3.0"
mkdirp "^0.5.1"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录