Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7ecb5821
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 搜索 >>
提交
7ecb5821
编写于
9月 17, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - remove IWindowService#log in favor of a logger that can log to the main side
上级
36e61492
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
155 addition
and
69 deletion
+155
-69
src/vs/code/electron-browser/issue/issueReporterMain.ts
src/vs/code/electron-browser/issue/issueReporterMain.ts
+3
-3
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
.../code/electron-browser/sharedProcess/sharedProcessMain.ts
+4
-4
src/vs/code/electron-main/app.ts
src/vs/code/electron-main/app.ts
+4
-4
src/vs/platform/log/common/log.ts
src/vs/platform/log/common/log.ts
+50
-1
src/vs/platform/log/common/logIpc.ts
src/vs/platform/log/common/logIpc.ts
+27
-4
src/vs/platform/windows/common/windows.ts
src/vs/platform/windows/common/windows.ts
+0
-1
src/vs/platform/windows/common/windowsIpc.ts
src/vs/platform/windows/common/windowsIpc.ts
+0
-1
src/vs/platform/windows/electron-browser/windowsService.ts
src/vs/platform/windows/electron-browser/windowsService.ts
+0
-4
src/vs/platform/windows/electron-main/windowsService.ts
src/vs/platform/windows/electron-main/windowsService.ts
+0
-18
src/vs/workbench/api/browser/mainThreadConsole.ts
src/vs/workbench/api/browser/mainThreadConsole.ts
+5
-4
src/vs/workbench/browser/web.simpleservices.ts
src/vs/workbench/browser/web.simpleservices.ts
+0
-4
src/vs/workbench/contrib/remote/common/remote.contribution.ts
...vs/workbench/contrib/remote/common/remote.contribution.ts
+4
-4
src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts
...ch/contrib/remote/electron-browser/remote.contribution.ts
+2
-2
src/vs/workbench/electron-browser/desktop.main.ts
src/vs/workbench/electron-browser/desktop.main.ts
+20
-7
src/vs/workbench/services/extensions/common/remoteConsoleUtil.ts
...workbench/services/extensions/common/remoteConsoleUtil.ts
+32
-0
src/vs/workbench/services/extensions/electron-browser/extensionHost.ts
...nch/services/extensions/electron-browser/extensionHost.ts
+4
-4
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+0
-4
未找到文件。
src/vs/code/electron-browser/issue/issueReporterMain.ts
浏览文件 @
7ecb5821
...
...
@@ -32,7 +32,7 @@ import { EnvironmentService } from 'vs/platform/environment/node/environmentServ
import
{
IssueReporterModel
,
IssueReporterData
as
IssueReporterModelData
}
from
'
vs/code/electron-browser/issue/issueReporterModel
'
;
import
{
IssueReporterData
,
IssueReporterStyles
,
IssueType
,
ISettingsSearchIssueReporterData
,
IssueReporterFeatures
,
IssueReporterExtensionData
}
from
'
vs/platform/issue/node/issue
'
;
import
BaseHtml
from
'
vs/code/electron-browser/issue/issueReporterPage
'
;
import
{
Log
LevelSett
erChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
Log
g
erChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
ILogService
,
getLogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
OcticonLabel
}
from
'
vs/base/browser/ui/octiconLabel/octiconLabel
'
;
import
{
normalizeGitHubUrl
}
from
'
vs/code/electron-browser/issue/issueReporterUtil
'
;
...
...
@@ -300,8 +300,8 @@ export class IssueReporter extends Disposable {
this
.
environmentService
=
new
EnvironmentService
(
configuration
,
configuration
.
execPath
);
const
logService
=
new
SpdLogService
(
`issuereporter
${
configuration
.
windowId
}
`
,
this
.
environmentService
.
logsPath
,
getLogLevel
(
this
.
environmentService
));
const
log
LevelClient
=
new
LogLevelSetterChannelClient
(
mainProcessService
.
getChannel
(
'
loglevel
'
));
this
.
logService
=
new
FollowerLogService
(
log
Level
Client
,
logService
);
const
log
gerClient
=
new
LoggerChannelClient
(
mainProcessService
.
getChannel
(
'
logger
'
));
this
.
logService
=
new
FollowerLogService
(
log
ger
Client
,
logService
);
const
sharedProcess
=
(
<
IWindowsService
>
serviceCollection
.
get
(
IWindowsService
)).
whenSharedProcessReady
()
.
then
(()
=>
connectNet
(
this
.
environmentService
.
sharedIPCHandle
,
`window:
${
configuration
.
windowId
}
`
));
...
...
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
浏览文件 @
7ecb5821
...
...
@@ -30,7 +30,7 @@ import { IWindowsService } from 'vs/platform/windows/common/windows';
import
{
WindowsService
}
from
'
vs/platform/windows/electron-browser/windowsService
'
;
import
{
ipcRenderer
}
from
'
electron
'
;
import
{
ILogService
,
LogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
Log
LevelSett
erChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
Log
g
erChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
LocalizationsService
}
from
'
vs/platform/localizations/node/localizations
'
;
import
{
ILocalizationsService
}
from
'
vs/platform/localizations/common/localizations
'
;
import
{
LocalizationsChannel
}
from
'
vs/platform/localizations/node/localizationsIpc
'
;
...
...
@@ -96,8 +96,8 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat
const
environmentService
=
new
EnvironmentService
(
initData
.
args
,
process
.
execPath
);
const
mainRouter
=
new
StaticRouter
(
ctx
=>
ctx
===
'
main
'
);
const
log
LevelClient
=
new
LogLevelSetterChannelClient
(
server
.
getChannel
(
'
loglevel
'
,
mainRouter
));
const
logService
=
new
FollowerLogService
(
log
Level
Client
,
new
SpdLogService
(
'
sharedprocess
'
,
environmentService
.
logsPath
,
initData
.
logLevel
));
const
log
gerClient
=
new
LoggerChannelClient
(
server
.
getChannel
(
'
logger
'
,
mainRouter
));
const
logService
=
new
FollowerLogService
(
log
ger
Client
,
new
SpdLogService
(
'
sharedprocess
'
,
environmentService
.
logsPath
,
initData
.
logLevel
));
disposables
.
add
(
logService
);
logService
.
info
(
'
main
'
,
JSON
.
stringify
(
configuration
));
...
...
@@ -135,7 +135,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat
const
services
=
new
ServiceCollection
();
const
environmentService
=
accessor
.
get
(
IEnvironmentService
);
const
{
appRoot
,
extensionsPath
,
extensionDevelopmentLocationURI
:
extensionDevelopmentLocationURI
,
isBuilt
,
installSourcePath
}
=
environmentService
;
const
telemetryLogService
=
new
FollowerLogService
(
log
Level
Client
,
new
SpdLogService
(
'
telemetry
'
,
environmentService
.
logsPath
,
initData
.
logLevel
));
const
telemetryLogService
=
new
FollowerLogService
(
log
ger
Client
,
new
SpdLogService
(
'
telemetry
'
,
environmentService
.
logsPath
,
initData
.
logLevel
));
telemetryLogService
.
info
(
'
The below are logs for every telemetry event sent from VS Code once the log level is set to trace.
'
);
telemetryLogService
.
info
(
'
===========================================================
'
);
...
...
src/vs/code/electron-main/app.ts
浏览文件 @
7ecb5821
...
...
@@ -47,7 +47,7 @@ import { DarwinUpdateService } from 'vs/platform/update/electron-main/updateServ
import
{
IIssueService
}
from
'
vs/platform/issue/node/issue
'
;
import
{
IssueChannel
}
from
'
vs/platform/issue/electron-main/issueIpc
'
;
import
{
IssueMainService
}
from
'
vs/platform/issue/electron-main/issueMainService
'
;
import
{
Log
LevelSett
erChannel
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
Log
g
erChannel
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
setUnexpectedErrorHandler
,
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
ElectronURLListener
}
from
'
vs/platform/url/electron-main/electronUrlListener
'
;
import
{
serve
as
serveDriver
}
from
'
vs/platform/driver/electron-main/driver
'
;
...
...
@@ -567,9 +567,9 @@ export class CodeApplication extends Disposable {
const
storageChannel
=
this
.
_register
(
new
GlobalStorageDatabaseChannel
(
this
.
logService
,
storageMainService
));
electronIpcServer
.
registerChannel
(
'
storage
'
,
storageChannel
);
const
log
LevelChannel
=
new
LogLevelSett
erChannel
(
accessor
.
get
(
ILogService
));
electronIpcServer
.
registerChannel
(
'
log
level
'
,
logLevel
Channel
);
sharedProcessClient
.
then
(
client
=>
client
.
registerChannel
(
'
log
level
'
,
logLevel
Channel
));
const
log
gerChannel
=
new
Logg
erChannel
(
accessor
.
get
(
ILogService
));
electronIpcServer
.
registerChannel
(
'
log
ger
'
,
logger
Channel
);
sharedProcessClient
.
then
(
client
=>
client
.
registerChannel
(
'
log
ger
'
,
logger
Channel
));
// ExtensionHost Debug broadcast service
electronIpcServer
.
registerChannel
(
ExtensionHostDebugBroadcastChannel
.
ChannelName
,
new
ExtensionHostDebugBroadcastChannel
());
...
...
src/vs/platform/log/common/log.ts
浏览文件 @
7ecb5821
...
...
@@ -8,6 +8,7 @@ import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
LoggerChannelClient
}
from
'
vs/platform/log/common/logIpc
'
;
export
const
ILogService
=
createServiceDecorator
<
ILogService
>
(
'
logService
'
);
...
...
@@ -183,6 +184,54 @@ export class ConsoleLogService extends AbstractLogService implements ILogService
dispose
():
void
{
}
}
export
class
ConsoleLogInMainService
extends
AbstractLogService
implements
ILogService
{
_serviceBrand
:
undefined
;
constructor
(
private
readonly
client
:
LoggerChannelClient
,
logLevel
:
LogLevel
=
DEFAULT_LOG_LEVEL
)
{
super
();
this
.
setLevel
(
logLevel
);
}
trace
(
message
:
string
,
...
args
:
any
[]):
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Trace
)
{
this
.
client
.
consoleLog
(
'
trace
'
,
[
message
,
...
args
]);
}
}
debug
(
message
:
string
,
...
args
:
any
[]):
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Debug
)
{
this
.
client
.
consoleLog
(
'
debug
'
,
[
message
,
...
args
]);
}
}
info
(
message
:
string
,
...
args
:
any
[]):
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Info
)
{
this
.
client
.
consoleLog
(
'
info
'
,
[
message
,
...
args
]);
}
}
warn
(
message
:
string
|
Error
,
...
args
:
any
[]):
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Warning
)
{
this
.
client
.
consoleLog
(
'
warn
'
,
[
message
,
...
args
]);
}
}
error
(
message
:
string
,
...
args
:
any
[]):
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Error
)
{
this
.
client
.
consoleLog
(
'
error
'
,
[
message
,
...
args
]);
}
}
critical
(
message
:
string
,
...
args
:
any
[]):
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Critical
)
{
this
.
client
.
consoleLog
(
'
critical
'
,
[
message
,
...
args
]);
}
}
dispose
():
void
{
}
}
export
class
MultiplexLogService
extends
AbstractLogService
implements
ILogService
{
_serviceBrand
:
undefined
;
...
...
@@ -326,4 +375,4 @@ export function getLogLevel(environmentService: IEnvironmentService): LogLevel {
}
}
return
DEFAULT_LOG_LEVEL
;
}
\ No newline at end of file
}
src/vs/platform/log/common/logIpc.ts
浏览文件 @
7ecb5821
...
...
@@ -7,7 +7,7 @@ import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
import
{
LogLevel
,
ILogService
,
DelegatedLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
export
class
Log
LevelSett
erChannel
implements
IServerChannel
{
export
class
Log
g
erChannel
implements
IServerChannel
{
onDidChangeLogLevel
:
Event
<
LogLevel
>
;
...
...
@@ -26,13 +26,32 @@ export class LogLevelSetterChannel implements IServerChannel {
call
(
_
:
unknown
,
command
:
string
,
arg
?:
any
):
Promise
<
any
>
{
switch
(
command
)
{
case
'
setLevel
'
:
this
.
service
.
setLevel
(
arg
);
return
Promise
.
resolve
();
case
'
consoleLog
'
:
this
.
consoleLog
(
arg
[
0
],
arg
[
1
]);
return
Promise
.
resolve
();
}
throw
new
Error
(
`Call not found:
${
command
}
`
);
}
private
consoleLog
(
severity
:
string
,
args
:
string
[]):
void
{
let
consoleFn
=
console
.
log
;
switch
(
severity
)
{
case
'
error
'
:
consoleFn
=
console
.
error
;
break
;
case
'
warn
'
:
consoleFn
=
console
.
warn
;
break
;
case
'
info
'
:
consoleFn
=
console
.
info
;
break
;
}
consoleFn
.
call
(
console
,
...
args
);
}
}
export
class
Log
LevelSett
erChannelClient
{
export
class
Log
g
erChannelClient
{
constructor
(
private
channel
:
IChannel
)
{
}
...
...
@@ -43,12 +62,16 @@ export class LogLevelSetterChannelClient {
setLevel
(
level
:
LogLevel
):
void
{
this
.
channel
.
call
(
'
setLevel
'
,
level
);
}
consoleLog
(
severity
:
string
,
args
:
string
[]):
void
{
this
.
channel
.
call
(
'
consoleLog
'
,
[
severity
,
args
]);
}
}
export
class
FollowerLogService
extends
DelegatedLogService
implements
ILogService
{
_serviceBrand
:
undefined
;
constructor
(
private
master
:
Log
LevelSett
erChannelClient
,
logService
:
ILogService
)
{
constructor
(
private
master
:
Log
g
erChannelClient
,
logService
:
ILogService
)
{
super
(
logService
);
this
.
_register
(
master
.
onDidChangeLogLevel
(
level
=>
logService
.
setLevel
(
level
)));
}
...
...
@@ -56,4 +79,4 @@ export class FollowerLogService extends DelegatedLogService implements ILogServi
setLevel
(
level
:
LogLevel
):
void
{
this
.
master
.
setLevel
(
level
);
}
}
\ No newline at end of file
}
src/vs/platform/windows/common/windows.ts
浏览文件 @
7ecb5821
...
...
@@ -156,7 +156,6 @@ export interface IWindowsService {
openExtensionDevelopmentHostWindow
(
args
:
ParsedArgs
,
env
:
IProcessEnvironment
):
Promise
<
void
>
;
getWindows
():
Promise
<
{
id
:
number
;
workspace
?:
IWorkspaceIdentifier
;
folderUri
?:
ISingleFolderWorkspaceIdentifier
;
title
:
string
;
filename
?:
string
;
}[]
>
;
getWindowCount
():
Promise
<
number
>
;
log
(
severity
:
string
,
args
:
string
[]):
Promise
<
void
>
;
showItemInFolder
(
path
:
URI
):
Promise
<
void
>
;
getActiveWindowId
():
Promise
<
number
|
undefined
>
;
...
...
src/vs/platform/windows/common/windowsIpc.ts
浏览文件 @
7ecb5821
...
...
@@ -109,7 +109,6 @@ export class WindowsChannel implements IServerChannel {
case
'
whenSharedProcessReady
'
:
return
this
.
service
.
whenSharedProcessReady
();
case
'
toggleSharedProcess
'
:
return
this
.
service
.
toggleSharedProcess
();
case
'
quit
'
:
return
this
.
service
.
quit
();
case
'
log
'
:
return
this
.
service
.
log
(
arg
[
0
],
arg
[
1
]);
case
'
showItemInFolder
'
:
return
this
.
service
.
showItemInFolder
(
URI
.
revive
(
arg
));
case
'
getActiveWindowId
'
:
return
this
.
service
.
getActiveWindowId
();
case
'
openExternal
'
:
return
this
.
service
.
openExternal
(
arg
);
...
...
src/vs/platform/windows/electron-browser/windowsService.ts
浏览文件 @
7ecb5821
...
...
@@ -226,10 +226,6 @@ export class WindowsService implements IWindowsService {
return
this
.
channel
.
call
(
'
getWindowCount
'
);
}
log
(
severity
:
string
,
args
:
string
[]):
Promise
<
void
>
{
return
this
.
channel
.
call
(
'
log
'
,
[
severity
,
args
]);
}
showItemInFolder
(
path
:
URI
):
Promise
<
void
>
{
return
this
.
channel
.
call
(
'
showItemInFolder
'
,
path
);
}
...
...
src/vs/platform/windows/electron-main/windowsService.ts
浏览文件 @
7ecb5821
...
...
@@ -336,24 +336,6 @@ export class WindowsService extends Disposable implements IWindowsService, IURLH
return
this
.
windowsMainService
.
getWindows
().
length
;
}
async
log
(
severity
:
string
,
args
:
string
[]):
Promise
<
void
>
{
let
consoleFn
=
console
.
log
;
switch
(
severity
)
{
case
'
error
'
:
consoleFn
=
console
.
error
;
break
;
case
'
warn
'
:
consoleFn
=
console
.
warn
;
break
;
case
'
info
'
:
consoleFn
=
console
.
info
;
break
;
}
consoleFn
.
call
(
console
,
...
args
);
}
async
showItemInFolder
(
resource
:
URI
):
Promise
<
void
>
{
this
.
logService
.
trace
(
'
windowsService#showItemInFolder
'
);
...
...
src/vs/workbench/api/browser/mainThreadConsole.ts
浏览文件 @
7ecb5821
...
...
@@ -6,9 +6,10 @@
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
MainContext
,
MainThreadConsoleShape
,
IExtHostContext
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IRemoteConsoleLog
,
log
,
parse
}
from
'
vs/base/common/console
'
;
import
{
IRemoteConsoleLog
,
log
}
from
'
vs/base/common/console
'
;
import
{
logRemoteEntry
}
from
'
vs/workbench/services/extensions/common/remoteConsoleUtil
'
;
import
{
parseExtensionDevOptions
}
from
'
vs/workbench/services/extensions/common/extensionDevOptions
'
;
import
{
I
WindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
I
LogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IExtensionHostDebugService
}
from
'
vs/platform/debug/common/extensionHostDebug
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadConsole
)
...
...
@@ -20,7 +21,7 @@ export class MainThreadConsole implements MainThreadConsoleShape {
constructor
(
extHostContext
:
IExtHostContext
,
@
IEnvironmentService
private
readonly
_environmentService
:
IEnvironmentService
,
@
I
WindowsService
private
readonly
_windowsService
:
IWindows
Service
,
@
I
LogService
private
readonly
_logService
:
ILog
Service
,
@
IExtensionHostDebugService
private
readonly
_extensionHostDebugService
:
IExtensionHostDebugService
,
)
{
const
devOpts
=
parseExtensionDevOptions
(
this
.
_environmentService
);
...
...
@@ -40,7 +41,7 @@ export class MainThreadConsole implements MainThreadConsoleShape {
// Log on main side if running tests from cli
if
(
this
.
_isExtensionDevTestFromCli
)
{
this
.
_windowsService
.
log
(
entry
.
severity
,
parse
(
entry
).
args
);
logRemoteEntry
(
this
.
_logService
,
entry
);
}
// Broadcast to other windows if we are in development mode
...
...
src/vs/workbench/browser/web.simpleservices.ts
浏览文件 @
7ecb5821
...
...
@@ -508,10 +508,6 @@ export class SimpleWindowsService implements IWindowsService {
return
Promise
.
resolve
(
this
.
windowCount
);
}
log
(
_severity
:
string
,
_args
:
string
[]):
Promise
<
void
>
{
return
Promise
.
resolve
();
}
showItemInFolder
(
_path
:
URI
):
Promise
<
void
>
{
return
Promise
.
resolve
();
}
...
...
src/vs/workbench/contrib/remote/common/remote.contribution.ts
浏览文件 @
7ecb5821
...
...
@@ -11,7 +11,7 @@ import { OperatingSystem, isWeb } from 'vs/base/common/platform';
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IRemoteAgentService
,
RemoteExtensionLogFileName
}
from
'
vs/workbench/services/remote/common/remoteAgentService
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
Log
LevelSett
erChannelClient
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
Log
g
erChannelClient
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
IOutputChannelRegistry
,
Extensions
as
OutputExt
,
}
from
'
vs/workbench/contrib/output/common/output
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
joinPath
}
from
'
vs/base/common/resources
'
;
...
...
@@ -79,9 +79,9 @@ class RemoteChannelsContribution extends Disposable implements IWorkbenchContrib
super
();
const
connection
=
remoteAgentService
.
getConnection
();
if
(
connection
)
{
const
log
LevelClient
=
new
LogLevelSetterChannelClient
(
connection
.
getChannel
(
'
loglevel
'
));
log
Level
Client
.
setLevel
(
logService
.
getLevel
());
this
.
_register
(
logService
.
onDidChangeLogLevel
(
level
=>
log
Level
Client
.
setLevel
(
level
)));
const
log
gerClient
=
new
LoggerChannelClient
(
connection
.
getChannel
(
'
logger
'
));
log
ger
Client
.
setLevel
(
logService
.
getLevel
());
this
.
_register
(
logService
.
onDidChangeLogLevel
(
level
=>
log
ger
Client
.
setLevel
(
level
)));
}
}
}
...
...
src/vs/workbench/contrib/remote/electron-browser/remote.contribution.ts
浏览文件 @
7ecb5821
...
...
@@ -26,7 +26,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import
{
IDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
DialogChannel
}
from
'
vs/platform/dialogs/electron-browser/dialogIpc
'
;
import
{
DownloadServiceChannel
}
from
'
vs/platform/download/common/downloadIpc
'
;
import
{
Log
LevelSett
erChannel
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
Log
g
erChannel
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
import
{
IDiagnosticInfoOptions
,
IRemoteDiagnosticInfo
}
from
'
vs/platform/diagnostics/common/diagnostics
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
...
...
@@ -229,7 +229,7 @@ class RemoteChannelsContribution implements IWorkbenchContribution {
if
(
connection
)
{
connection
.
registerChannel
(
'
dialog
'
,
new
DialogChannel
(
dialogService
));
connection
.
registerChannel
(
'
download
'
,
new
DownloadServiceChannel
(
downloadService
));
connection
.
registerChannel
(
'
log
level
'
,
new
LogLevelSett
erChannel
(
logService
));
connection
.
registerChannel
(
'
log
ger
'
,
new
Logg
erChannel
(
logService
));
}
}
}
...
...
src/vs/workbench/electron-browser/desktop.main.ts
浏览文件 @
7ecb5821
...
...
@@ -23,9 +23,9 @@ import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron
import
{
IWindowConfiguration
}
from
'
vs/platform/windows/common/windows
'
;
import
{
webFrame
}
from
'
electron
'
;
import
{
ISingleFolderWorkspaceIdentifier
,
IWorkspaceInitializationPayload
,
ISingleFolderWorkspaceInitializationPayload
,
reviveWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
ConsoleLogService
,
MultiplexLogService
,
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ConsoleLogService
,
MultiplexLogService
,
ILogService
,
ConsoleLogInMainService
}
from
'
vs/platform/log/common/log
'
;
import
{
StorageService
}
from
'
vs/platform/storage/node/storageService
'
;
import
{
Log
LevelSett
erChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/common/logIpc
'
;
import
{
Log
g
erChannelClient
,
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
'
;
...
...
@@ -345,12 +345,25 @@ class CodeRendererMain extends Disposable {
}
private
createLogService
(
mainProcessService
:
IMainProcessService
,
environmentService
:
IWorkbenchEnvironmentService
):
ILogService
{
const
spdlogService
=
new
SpdLogService
(
`renderer
${
this
.
environmentService
.
configuration
.
windowId
}
`
,
environmentService
.
logsPath
,
this
.
environmentService
.
configuration
.
logLevel
);
const
consoleLogService
=
new
ConsoleLogService
(
this
.
environmentService
.
configuration
.
logLevel
);
const
logService
=
new
MultiplexLogService
([
consoleLogService
,
spdlogService
]);
const
logLevelClient
=
new
LogLevelSetterChannelClient
(
mainProcessService
.
getChannel
(
'
loglevel
'
));
const
loggerClient
=
new
LoggerChannelClient
(
mainProcessService
.
getChannel
(
'
logger
'
));
// Extension development test CLI: forward everything to main side
const
loggers
:
ILogService
[]
=
[];
if
(
environmentService
.
isExtensionDevelopment
&&
!!
environmentService
.
extensionTestsLocationURI
)
{
loggers
.
push
(
new
ConsoleLogInMainService
(
loggerClient
,
this
.
environmentService
.
configuration
.
logLevel
)
);
}
// Normal logger: spdylog and console
else
{
loggers
.
push
(
new
ConsoleLogService
(
this
.
environmentService
.
configuration
.
logLevel
),
new
SpdLogService
(
`renderer
${
this
.
environmentService
.
configuration
.
windowId
}
`
,
environmentService
.
logsPath
,
this
.
environmentService
.
configuration
.
logLevel
)
);
}
return
new
FollowerLogService
(
log
LevelClient
,
logService
);
return
new
FollowerLogService
(
log
gerClient
,
new
MultiplexLogService
(
loggers
)
);
}
}
...
...
src/vs/workbench/services/extensions/common/remoteConsoleUtil.ts
0 → 100644
浏览文件 @
7ecb5821
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
IRemoteConsoleLog
,
parse
}
from
'
vs/base/common/console
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
export
function
logRemoteEntry
(
logService
:
ILogService
,
entry
:
IRemoteConsoleLog
):
void
{
const
args
=
parse
(
entry
).
args
;
const
firstArg
=
args
.
shift
();
if
(
typeof
firstArg
!==
'
string
'
)
{
return
;
}
if
(
!
entry
.
severity
)
{
entry
.
severity
=
'
info
'
;
}
switch
(
entry
.
severity
)
{
case
'
log
'
:
case
'
info
'
:
logService
.
info
(
firstArg
,
...
args
);
break
;
case
'
warn
'
:
logService
.
warn
(
firstArg
,
...
args
);
break
;
case
'
error
'
:
logService
.
error
(
firstArg
,
...
args
);
break
;
}
}
src/vs/workbench/services/extensions/electron-browser/extensionHost.ts
浏览文件 @
7ecb5821
...
...
@@ -14,7 +14,8 @@ import { toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import
*
as
objects
from
'
vs/base/common/objects
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IRemoteConsoleLog
,
log
,
parse
}
from
'
vs/base/common/console
'
;
import
{
IRemoteConsoleLog
,
log
}
from
'
vs/base/common/console
'
;
import
{
logRemoteEntry
}
from
'
vs/workbench/services/extensions/common/remoteConsoleUtil
'
;
import
{
findFreePort
,
randomPort
}
from
'
vs/base/node/ports
'
;
import
{
IMessagePassingProtocol
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
PersistentProtocol
}
from
'
vs/base/parts/ipc/common/ipc.net
'
;
...
...
@@ -26,7 +27,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import
product
from
'
vs/platform/product/common/product
'
;
import
{
INotificationService
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWindowService
,
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IInitData
,
UIKind
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
MessageType
,
createMessageOfType
,
isMessageOfType
}
from
'
vs/workbench/services/extensions/common/extensionHostProtocol
'
;
...
...
@@ -67,7 +68,6 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
private
readonly
_extensionHostLogsLocation
:
URI
,
@
IWorkspaceContextService
private
readonly
_contextService
:
IWorkspaceContextService
,
@
INotificationService
private
readonly
_notificationService
:
INotificationService
,
@
IWindowsService
private
readonly
_windowsService
:
IWindowsService
,
@
IWindowService
private
readonly
_windowService
:
IWindowService
,
@
ILifecycleService
private
readonly
_lifecycleService
:
ILifecycleService
,
@
IWorkbenchEnvironmentService
private
readonly
_environmentService
:
IWorkbenchEnvironmentService
,
...
...
@@ -435,7 +435,7 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
// Log on main side if running tests from cli
if
(
this
.
_isExtensionDevTestFromCli
)
{
this
.
_windowsService
.
log
(
entry
.
severity
,
parse
(
entry
).
args
);
logRemoteEntry
(
this
.
_logService
,
entry
);
}
// Broadcast to other windows if we are in development mode
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
7ecb5821
...
...
@@ -1494,10 +1494,6 @@ export class TestWindowsService implements IWindowsService {
return
Promise
.
resolve
(
this
.
windowCount
);
}
log
(
_severity
:
string
,
_args
:
string
[]):
Promise
<
void
>
{
return
Promise
.
resolve
();
}
showItemInFolder
(
_path
:
URI
):
Promise
<
void
>
{
return
Promise
.
resolve
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录