Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
bc60d930
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,体验更适合开发者的 AI 搜索 >>
提交
bc60d930
编写于
5月 06, 2020
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move desktop log service to workbech/services
上级
a32df4c2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
75 addition
and
60 deletion
+75
-60
src/vs/workbench/electron-browser/desktop.main.ts
src/vs/workbench/electron-browser/desktop.main.ts
+3
-60
src/vs/workbench/services/log/electron-browser/logService.ts
src/vs/workbench/services/log/electron-browser/logService.ts
+72
-0
未找到文件。
src/vs/workbench/electron-browser/desktop.main.ts
浏览文件 @
bc60d930
...
...
@@ -20,16 +20,15 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
import
{
KeyboardMapperFactory
}
from
'
vs/workbench/services/keybinding/electron-browser/nativeKeymapService
'
;
import
{
INativeWindowConfiguration
}
from
'
vs/platform/windows/node/window
'
;
import
{
ISingleFolderWorkspaceIdentifier
,
IWorkspaceInitializationPayload
,
ISingleFolderWorkspaceInitializationPayload
,
reviveWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
ConsoleLogService
,
MultiplexLogService
,
ILogService
,
ConsoleLogInMainService
,
Delegated
LogService
}
from
'
vs/platform/log/common/log
'
;
import
{
I
LogService
}
from
'
vs/platform/log/common/log
'
;
import
{
NativeStorageService
}
from
'
vs/platform/storage/node/storageService
'
;
import
{
LoggerChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
sanitizeFilePath
}
from
'
vs/base/common/extpath
'
;
import
{
GlobalStorageDatabaseChannelClient
}
from
'
vs/platform/storage/node/storageIpc
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
Disposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
registerWindowDriver
}
from
'
vs/platform/driver/electron-browser/driver
'
;
import
{
IMainProcessService
,
MainProcessService
}
from
'
vs/platform/ipc/electron-browser/mainProcessService
'
;
import
{
RemoteAuthorityResolverService
}
from
'
vs/platform/remote/electron-browser/remoteAuthorityResolverService
'
;
...
...
@@ -41,7 +40,6 @@ import { IFileService } from 'vs/platform/files/common/files';
import
{
DiskFileSystemProvider
}
from
'
vs/platform/files/electron-browser/diskFileSystemProvider
'
;
import
{
RemoteFileSystemProvider
}
from
'
vs/workbench/services/remote/common/remoteAgentFileSystemChannel
'
;
import
{
ConfigurationCache
}
from
'
vs/workbench/services/configuration/node/configurationCache
'
;
import
{
SpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
SignService
}
from
'
vs/platform/sign/node/signService
'
;
import
{
ISignService
}
from
'
vs/platform/sign/common/sign
'
;
import
{
FileUserDataProvider
}
from
'
vs/workbench/services/userData/common/fileUserDataProvider
'
;
...
...
@@ -50,8 +48,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
import
product
from
'
vs/platform/product/common/product
'
;
import
{
NativeResourceIdentityService
}
from
'
vs/platform/resource/node/resourceIdentityServiceImpl
'
;
import
{
IResourceIdentityService
}
from
'
vs/platform/resource/common/resourceIdentityService
'
;
import
{
ILifecycleService
,
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
BufferLogService
}
from
'
vs/platform/log/common/bufferLog
'
;
import
{
DesktopLogService
}
from
'
vs/workbench/services/log/electron-browser/logService
'
;
class
DesktopMain
extends
Disposable
{
...
...
@@ -124,12 +121,6 @@ class DesktopMain extends Disposable {
// Startup
const
instantiationService
=
workbench
.
startup
();
// Lifecycle Listeners
instantiationService
.
invokeFunction
(
accessor
=>
{
const
lifecycleService
=
accessor
.
get
(
ILifecycleService
);
lifecycleService
.
when
(
LifecyclePhase
.
Restored
).
then
(()
=>
services
.
logService
.
init
());
});
// Window
this
.
_register
(
instantiationService
.
createInstance
(
NativeWindow
));
...
...
@@ -324,54 +315,6 @@ class DesktopMain extends Disposable {
}
class
DesktopLogService
extends
DelegatedLogService
{
private
readonly
bufferSpdLogService
:
BufferLogService
|
undefined
;
private
readonly
windowId
:
number
;
private
readonly
environmentService
:
NativeWorkbenchEnvironmentService
;
constructor
(
windowId
:
number
,
mainProcessService
:
IMainProcessService
,
environmentService
:
NativeWorkbenchEnvironmentService
)
{
const
disposables
=
new
DisposableStore
();
const
loggerClient
=
new
LoggerChannelClient
(
mainProcessService
.
getChannel
(
'
logger
'
));
let
bufferSpdLogService
:
BufferLogService
|
undefined
;
// Extension development test CLI: forward everything to main side
const
loggers
:
ILogService
[]
=
[];
if
(
environmentService
.
isExtensionDevelopment
&&
!!
environmentService
.
extensionTestsLocationURI
)
{
loggers
.
push
(
disposables
.
add
(
new
ConsoleLogInMainService
(
loggerClient
,
environmentService
.
configuration
.
logLevel
))
);
}
// Normal logger: spdylog and console
else
{
bufferSpdLogService
=
disposables
.
add
(
new
BufferLogService
(
environmentService
.
configuration
.
logLevel
));
loggers
.
push
(
disposables
.
add
(
new
ConsoleLogService
(
environmentService
.
configuration
.
logLevel
)),
bufferSpdLogService
,
);
}
const
multiplexLogger
=
disposables
.
add
(
new
MultiplexLogService
(
loggers
));
const
followerLogger
=
disposables
.
add
(
new
FollowerLogService
(
loggerClient
,
multiplexLogger
));
super
(
followerLogger
);
this
.
bufferSpdLogService
=
bufferSpdLogService
;
this
.
windowId
=
windowId
;
this
.
environmentService
=
environmentService
;
this
.
_register
(
disposables
);
}
init
():
void
{
if
(
this
.
bufferSpdLogService
)
{
this
.
bufferSpdLogService
.
logger
=
this
.
_register
(
new
SpdLogService
(
`renderer
${
this
.
windowId
}
`
,
this
.
environmentService
.
logsPath
,
this
.
getLevel
()));
this
.
trace
(
'
Created Spdlogger
'
);
}
}
}
export
function
main
(
configuration
:
INativeWindowConfiguration
):
Promise
<
void
>
{
const
workbench
=
new
DesktopMain
(
configuration
);
...
...
src/vs/workbench/services/log/electron-browser/logService.ts
0 → 100644
浏览文件 @
bc60d930
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
DelegatedLogService
,
ILogService
,
ConsoleLogInMainService
,
ConsoleLogService
,
MultiplexLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
BufferLogService
}
from
'
vs/platform/log/common/bufferLog
'
;
import
{
NativeWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/electron-browser/environmentService
'
;
import
{
IMainProcessService
}
from
'
vs/platform/ipc/electron-browser/mainProcessService
'
;
import
{
LoggerChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
SpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
IWorkbenchContribution
,
IWorkbenchContributionsRegistry
,
Extensions
}
from
'
vs/workbench/common/contributions
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
export
class
DesktopLogService
extends
DelegatedLogService
{
private
readonly
bufferSpdLogService
:
BufferLogService
|
undefined
;
private
readonly
windowId
:
number
;
private
readonly
environmentService
:
NativeWorkbenchEnvironmentService
;
constructor
(
windowId
:
number
,
mainProcessService
:
IMainProcessService
,
environmentService
:
NativeWorkbenchEnvironmentService
)
{
const
disposables
=
new
DisposableStore
();
const
loggerClient
=
new
LoggerChannelClient
(
mainProcessService
.
getChannel
(
'
logger
'
));
let
bufferSpdLogService
:
BufferLogService
|
undefined
;
// Extension development test CLI: forward everything to main side
const
loggers
:
ILogService
[]
=
[];
if
(
environmentService
.
isExtensionDevelopment
&&
!!
environmentService
.
extensionTestsLocationURI
)
{
loggers
.
push
(
disposables
.
add
(
new
ConsoleLogInMainService
(
loggerClient
,
environmentService
.
configuration
.
logLevel
))
);
}
// Normal logger: spdylog and console
else
{
bufferSpdLogService
=
disposables
.
add
(
new
BufferLogService
(
environmentService
.
configuration
.
logLevel
));
loggers
.
push
(
disposables
.
add
(
new
ConsoleLogService
(
environmentService
.
configuration
.
logLevel
)),
bufferSpdLogService
,
);
}
const
multiplexLogger
=
disposables
.
add
(
new
MultiplexLogService
(
loggers
));
const
followerLogger
=
disposables
.
add
(
new
FollowerLogService
(
loggerClient
,
multiplexLogger
));
super
(
followerLogger
);
this
.
bufferSpdLogService
=
bufferSpdLogService
;
this
.
windowId
=
windowId
;
this
.
environmentService
=
environmentService
;
this
.
_register
(
disposables
);
}
init
():
void
{
if
(
this
.
bufferSpdLogService
)
{
this
.
bufferSpdLogService
.
logger
=
this
.
_register
(
new
SpdLogService
(
`renderer
${
this
.
windowId
}
`
,
this
.
environmentService
.
logsPath
,
this
.
getLevel
()));
this
.
trace
(
'
Created Spdlogger
'
);
}
}
}
class
DesktopLogServiceInitContribution
implements
IWorkbenchContribution
{
constructor
(@
ILogService
logService
:
ILogService
)
{
if
(
logService
instanceof
DesktopLogService
)
{
logService
.
init
();
}
}
}
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
Extensions
.
Workbench
).
registerWorkbenchContribution
(
DesktopLogServiceInitContribution
,
LifecyclePhase
.
Restored
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录