Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
4026f653
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4026f653
编写于
5月 27, 2019
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#72906 Restructure spdlog service
上级
25e9e092
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
89 addition
and
44 deletion
+89
-44
src/vs/code/electron-browser/issue/issueReporterMain.ts
src/vs/code/electron-browser/issue/issueReporterMain.ts
+2
-2
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
.../code/electron-browser/sharedProcess/sharedProcessMain.ts
+3
-3
src/vs/code/electron-main/main.ts
src/vs/code/electron-main/main.ts
+2
-7
src/vs/code/node/cliProcessMain.ts
src/vs/code/node/cliProcessMain.ts
+2
-2
src/vs/platform/log/node/spdlogService.ts
src/vs/platform/log/node/spdlogService.ts
+76
-26
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+2
-2
src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
...nch/services/extensions/node/extensionHostProcessSetup.ts
+2
-2
未找到文件。
src/vs/code/electron-browser/issue/issueReporterMain.ts
浏览文件 @
4026f653
...
@@ -33,7 +33,6 @@ import { EnvironmentService } from 'vs/platform/environment/node/environmentServ
...
@@ -33,7 +33,6 @@ import { EnvironmentService } from 'vs/platform/environment/node/environmentServ
import
{
IssueReporterModel
,
IssueReporterData
as
IssueReporterModelData
}
from
'
vs/code/electron-browser/issue/issueReporterModel
'
;
import
{
IssueReporterModel
,
IssueReporterData
as
IssueReporterModelData
}
from
'
vs/code/electron-browser/issue/issueReporterModel
'
;
import
{
IssueReporterData
,
IssueReporterStyles
,
IssueType
,
ISettingsSearchIssueReporterData
,
IssueReporterFeatures
,
IssueReporterExtensionData
}
from
'
vs/platform/issue/common/issue
'
;
import
{
IssueReporterData
,
IssueReporterStyles
,
IssueType
,
ISettingsSearchIssueReporterData
,
IssueReporterFeatures
,
IssueReporterExtensionData
}
from
'
vs/platform/issue/common/issue
'
;
import
BaseHtml
from
'
vs/code/electron-browser/issue/issueReporterPage
'
;
import
BaseHtml
from
'
vs/code/electron-browser/issue/issueReporterPage
'
;
import
{
createBufferSpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
LogLevelSetterChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/node/logIpc
'
;
import
{
LogLevelSetterChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/node/logIpc
'
;
import
{
ILogService
,
getLogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
,
getLogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
OcticonLabel
}
from
'
vs/base/browser/ui/octiconLabel/octiconLabel
'
;
import
{
OcticonLabel
}
from
'
vs/base/browser/ui/octiconLabel/octiconLabel
'
;
...
@@ -41,6 +40,7 @@ import { normalizeGitHubUrl } from 'vs/code/electron-browser/issue/issueReporter
...
@@ -41,6 +40,7 @@ import { normalizeGitHubUrl } from 'vs/code/electron-browser/issue/issueReporter
import
{
Button
}
from
'
vs/base/browser/ui/button/button
'
;
import
{
Button
}
from
'
vs/base/browser/ui/button/button
'
;
import
{
withUndefinedAsNull
}
from
'
vs/base/common/types
'
;
import
{
withUndefinedAsNull
}
from
'
vs/base/common/types
'
;
import
{
SystemInfo
,
isRemoteDiagnosticError
}
from
'
vs/platform/diagnostics/common/diagnosticsService
'
;
import
{
SystemInfo
,
isRemoteDiagnosticError
}
from
'
vs/platform/diagnostics/common/diagnosticsService
'
;
import
{
SpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
const
MAX_URL_LENGTH
=
2045
;
const
MAX_URL_LENGTH
=
2045
;
...
@@ -300,7 +300,7 @@ export class IssueReporter extends Disposable {
...
@@ -300,7 +300,7 @@ export class IssueReporter extends Disposable {
serviceCollection
.
set
(
IWindowsService
,
new
WindowsService
(
mainProcessService
));
serviceCollection
.
set
(
IWindowsService
,
new
WindowsService
(
mainProcessService
));
this
.
environmentService
=
new
EnvironmentService
(
configuration
,
configuration
.
execPath
);
this
.
environmentService
=
new
EnvironmentService
(
configuration
,
configuration
.
execPath
);
const
logService
=
createBufferSpdLogService
(
`issuereporter
${
configuration
.
windowId
}
`
,
getLogLevel
(
this
.
environmentService
),
this
.
environmentService
.
logsPath
);
const
logService
=
new
SpdLogService
(
`issuereporter
${
configuration
.
windowId
}
`
,
this
.
environmentService
.
logsPath
,
getLogLevel
(
this
.
environmentService
)
);
const
logLevelClient
=
new
LogLevelSetterChannelClient
(
mainProcessService
.
getChannel
(
'
loglevel
'
));
const
logLevelClient
=
new
LogLevelSetterChannelClient
(
mainProcessService
.
getChannel
(
'
loglevel
'
));
this
.
logService
=
new
FollowerLogService
(
logLevelClient
,
logService
);
this
.
logService
=
new
FollowerLogService
(
logLevelClient
,
logService
);
...
...
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
浏览文件 @
4026f653
...
@@ -30,7 +30,6 @@ import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppen
...
@@ -30,7 +30,6 @@ import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppen
import
{
IWindowsService
,
ActiveWindowManager
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowsService
,
ActiveWindowManager
}
from
'
vs/platform/windows/common/windows
'
;
import
{
WindowsService
}
from
'
vs/platform/windows/electron-browser/windowsService
'
;
import
{
WindowsService
}
from
'
vs/platform/windows/electron-browser/windowsService
'
;
import
{
ipcRenderer
}
from
'
electron
'
;
import
{
ipcRenderer
}
from
'
electron
'
;
import
{
createBufferSpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
ILogService
,
LogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
,
LogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
LogLevelSetterChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/node/logIpc
'
;
import
{
LogLevelSetterChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/node/logIpc
'
;
import
{
LocalizationsService
}
from
'
vs/platform/localizations/node/localizations
'
;
import
{
LocalizationsService
}
from
'
vs/platform/localizations/node/localizations
'
;
...
@@ -48,6 +47,7 @@ import { StorageDataCleaner } from 'vs/code/electron-browser/sharedProcess/contr
...
@@ -48,6 +47,7 @@ import { StorageDataCleaner } from 'vs/code/electron-browser/sharedProcess/contr
import
{
LogsDataCleaner
}
from
'
vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner
'
;
import
{
LogsDataCleaner
}
from
'
vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner
'
;
import
{
IMainProcessService
}
from
'
vs/platform/ipc/electron-browser/mainProcessService
'
;
import
{
IMainProcessService
}
from
'
vs/platform/ipc/electron-browser/mainProcessService
'
;
import
{
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
SpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
export
interface
ISharedProcessConfiguration
{
export
interface
ISharedProcessConfiguration
{
readonly
machineId
:
string
;
readonly
machineId
:
string
;
...
@@ -94,7 +94,7 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
...
@@ -94,7 +94,7 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
const
mainRouter
=
new
StaticRouter
(
ctx
=>
ctx
===
'
main
'
);
const
mainRouter
=
new
StaticRouter
(
ctx
=>
ctx
===
'
main
'
);
const
logLevelClient
=
new
LogLevelSetterChannelClient
(
server
.
getChannel
(
'
loglevel
'
,
mainRouter
));
const
logLevelClient
=
new
LogLevelSetterChannelClient
(
server
.
getChannel
(
'
loglevel
'
,
mainRouter
));
const
logService
=
new
FollowerLogService
(
logLevelClient
,
createBufferSpdLogService
(
'
sharedprocess
'
,
initData
.
logLevel
,
environmentService
.
logsPath
));
const
logService
=
new
FollowerLogService
(
logLevelClient
,
new
SpdLogService
(
'
sharedprocess
'
,
environmentService
.
logsPath
,
initData
.
logLevel
));
disposables
.
push
(
logService
);
disposables
.
push
(
logService
);
logService
.
info
(
'
main
'
,
JSON
.
stringify
(
configuration
));
logService
.
info
(
'
main
'
,
JSON
.
stringify
(
configuration
));
...
@@ -122,7 +122,7 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
...
@@ -122,7 +122,7 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
const
services
=
new
ServiceCollection
();
const
services
=
new
ServiceCollection
();
const
environmentService
=
accessor
.
get
(
IEnvironmentService
);
const
environmentService
=
accessor
.
get
(
IEnvironmentService
);
const
{
appRoot
,
extensionsPath
,
extensionDevelopmentLocationURI
:
extensionDevelopmentLocationURI
,
isBuilt
,
installSourcePath
}
=
environmentService
;
const
{
appRoot
,
extensionsPath
,
extensionDevelopmentLocationURI
:
extensionDevelopmentLocationURI
,
isBuilt
,
installSourcePath
}
=
environmentService
;
const
telemetryLogService
=
new
FollowerLogService
(
logLevelClient
,
createBufferSpdLogService
(
'
telemetry
'
,
initData
.
logLevel
,
environmentService
.
logsPath
));
const
telemetryLogService
=
new
FollowerLogService
(
logLevelClient
,
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
(
'
The below are logs for every telemetry event sent from VS Code once the log level is set to trace.
'
);
telemetryLogService
.
info
(
'
===========================================================
'
);
telemetryLogService
.
info
(
'
===========================================================
'
);
...
...
src/vs/code/electron-main/main.ts
浏览文件 @
4026f653
...
@@ -32,7 +32,7 @@ import * as fs from 'fs';
...
@@ -32,7 +32,7 @@ import * as fs from 'fs';
import
{
CodeApplication
}
from
'
vs/code/electron-main/app
'
;
import
{
CodeApplication
}
from
'
vs/code/electron-main/app
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
mnemonicButtonLabel
}
from
'
vs/base/common/labels
'
;
import
{
mnemonicButtonLabel
}
from
'
vs/base/common/labels
'
;
import
{
create
SpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
SpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
IDiagnosticsService
,
DiagnosticsService
}
from
'
vs/platform/diagnostics/electron-main/diagnosticsService
'
;
import
{
IDiagnosticsService
,
DiagnosticsService
}
from
'
vs/platform/diagnostics/electron-main/diagnosticsService
'
;
import
{
BufferLogService
}
from
'
vs/platform/log/common/bufferLog
'
;
import
{
BufferLogService
}
from
'
vs/platform/log/common/bufferLog
'
;
import
{
uploadLogs
}
from
'
vs/code/electron-main/logUploader
'
;
import
{
uploadLogs
}
from
'
vs/code/electron-main/logUploader
'
;
...
@@ -293,12 +293,7 @@ async function startup(args: ParsedArgs): Promise<void> {
...
@@ -293,12 +293,7 @@ async function startup(args: ParsedArgs): Promise<void> {
}
}
const
mainIpcServer
=
await
instantiationService
.
invokeFunction
(
setupIPC
);
const
mainIpcServer
=
await
instantiationService
.
invokeFunction
(
setupIPC
);
bufferLogService
.
logger
=
new
SpdLogService
(
'
main
'
,
environmentService
.
logsPath
,
bufferLogService
.
getLevel
());
(
async
()
=>
{
const
logger
=
await
createSpdLogService
(
'
main
'
,
bufferLogService
.
getLevel
(),
environmentService
.
logsPath
);
bufferLogService
.
logger
=
logger
;
})();
return
instantiationService
.
createInstance
(
CodeApplication
,
mainIpcServer
,
instanceEnvironment
).
startup
();
return
instantiationService
.
createInstance
(
CodeApplication
,
mainIpcServer
,
instanceEnvironment
).
startup
();
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
src/vs/code/node/cliProcessMain.ts
浏览文件 @
4026f653
...
@@ -31,7 +31,6 @@ import { mkdirp, writeFile } from 'vs/base/node/pfs';
...
@@ -31,7 +31,6 @@ import { mkdirp, writeFile } from 'vs/base/node/pfs';
import
{
getBaseLabel
}
from
'
vs/base/common/labels
'
;
import
{
getBaseLabel
}
from
'
vs/base/common/labels
'
;
import
{
IStateService
}
from
'
vs/platform/state/common/state
'
;
import
{
IStateService
}
from
'
vs/platform/state/common/state
'
;
import
{
StateService
}
from
'
vs/platform/state/node/stateService
'
;
import
{
StateService
}
from
'
vs/platform/state/node/stateService
'
;
import
{
createBufferSpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
ILogService
,
getLogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
,
getLogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
isPromiseCanceledError
}
from
'
vs/base/common/errors
'
;
import
{
isPromiseCanceledError
}
from
'
vs/base/common/errors
'
;
import
{
areSameExtensions
,
adoptToGalleryExtensionId
,
getGalleryExtensionId
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
areSameExtensions
,
adoptToGalleryExtensionId
,
getGalleryExtensionId
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
...
@@ -41,6 +40,7 @@ import { IExtensionManifest, ExtensionType, isLanguagePackExtension } from 'vs/p
...
@@ -41,6 +40,7 @@ import { IExtensionManifest, ExtensionType, isLanguagePackExtension } from 'vs/p
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
LocalizationsService
}
from
'
vs/platform/localizations/node/localizations
'
;
import
{
LocalizationsService
}
from
'
vs/platform/localizations/node/localizations
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
SpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
const
notFound
=
(
id
:
string
)
=>
localize
(
'
notFound
'
,
"
Extension '{0}' not found.
"
,
id
);
const
notFound
=
(
id
:
string
)
=>
localize
(
'
notFound
'
,
"
Extension '{0}' not found.
"
,
id
);
const
notInstalled
=
(
id
:
string
)
=>
localize
(
'
notInstalled
'
,
"
Extension '{0}' is not installed.
"
,
id
);
const
notInstalled
=
(
id
:
string
)
=>
localize
(
'
notInstalled
'
,
"
Extension '{0}' is not installed.
"
,
id
);
...
@@ -279,7 +279,7 @@ export function main(argv: ParsedArgs): Promise<void> {
...
@@ -279,7 +279,7 @@ export function main(argv: ParsedArgs): Promise<void> {
const
services
=
new
ServiceCollection
();
const
services
=
new
ServiceCollection
();
const
environmentService
=
new
EnvironmentService
(
argv
,
process
.
execPath
);
const
environmentService
=
new
EnvironmentService
(
argv
,
process
.
execPath
);
const
logService
=
createBufferSpdLogService
(
'
cli
'
,
getLogLevel
(
environmentService
),
environmentService
.
logsPath
);
const
logService
:
ILogService
=
new
SpdLogService
(
'
cli
'
,
environmentService
.
logsPath
,
getLogLevel
(
environmentService
)
);
process
.
once
(
'
exit
'
,
()
=>
logService
.
dispose
());
process
.
once
(
'
exit
'
,
()
=>
logService
.
dispose
());
logService
.
info
(
'
main
'
,
argv
);
logService
.
info
(
'
main
'
,
argv
);
...
...
src/vs/platform/log/node/spdlogService.ts
浏览文件 @
4026f653
...
@@ -4,24 +4,20 @@
...
@@ -4,24 +4,20 @@
*--------------------------------------------------------------------------------------------*/
*--------------------------------------------------------------------------------------------*/
import
*
as
path
from
'
vs/base/common/path
'
;
import
*
as
path
from
'
vs/base/common/path
'
;
import
{
ILogService
,
LogLevel
,
NullLogService
,
AbstractLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
,
LogLevel
,
AbstractLogService
}
from
'
vs/platform/log/common/log
'
;
import
*
as
spdlog
from
'
spdlog
'
;
import
*
as
spdlog
from
'
spdlog
'
;
import
{
BufferLogService
}
from
'
vs/platform/log/common/bufferLog
'
;
export
async
function
createSpdLogService
(
processName
:
string
,
logLevel
:
LogLevel
,
logsFolder
:
string
):
Promise
<
ILogService
>
{
async
function
createSpdLogLogger
(
processName
:
string
,
logsFolder
:
string
):
Promise
<
spdlog
.
RotatingLogger
|
null
>
{
// Do not crash if spdlog cannot be loaded
// Do not crash if spdlog cannot be loaded
try
{
try
{
const
_spdlog
:
typeof
spdlog
=
require
.
__$__nodeRequire
(
'
spdlog
'
);
const
_spdlog
=
await
import
(
'
spdlog
'
);
_spdlog
.
setAsyncMode
(
8192
,
500
);
_spdlog
.
setAsyncMode
(
8192
,
500
);
const
logfilePath
=
path
.
join
(
logsFolder
,
`
${
processName
}
.log`
);
const
logfilePath
=
path
.
join
(
logsFolder
,
`
${
processName
}
.log`
);
const
logger
=
await
_spdlog
.
createRotatingLoggerAsync
(
processName
,
logfilePath
,
1024
*
1024
*
5
,
6
);
return
_spdlog
.
createRotatingLoggerAsync
(
processName
,
logfilePath
,
1024
*
1024
*
5
,
6
);
logger
.
setLevel
(
0
);
return
new
SpdLogService
(
logger
,
logLevel
);
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
error
(
e
);
console
.
error
(
e
);
}
}
return
n
ew
NullLogService
()
;
return
n
ull
;
}
}
export
function
createRotatingLogger
(
name
:
string
,
filename
:
string
,
filesize
:
number
,
filecount
:
number
):
spdlog
.
RotatingLogger
{
export
function
createRotatingLogger
(
name
:
string
,
filename
:
string
,
filesize
:
number
,
filecount
:
number
):
spdlog
.
RotatingLogger
{
...
@@ -29,45 +25,87 @@ export function createRotatingLogger(name: string, filename: string, filesize: n
...
@@ -29,45 +25,87 @@ export function createRotatingLogger(name: string, filename: string, filesize: n
return
_spdlog
.
createRotatingLogger
(
name
,
filename
,
filesize
,
filecount
);
return
_spdlog
.
createRotatingLogger
(
name
,
filename
,
filesize
,
filecount
);
}
}
export
function
createBufferSpdLogService
(
processName
:
string
,
logLevel
:
LogLevel
,
logsFolder
:
string
):
ILogService
{
interface
ILog
{
const
bufferLogService
=
new
BufferLogService
();
level
:
LogLevel
;
createSpdLogService
(
processName
,
logLevel
,
logsFolder
).
then
(
logger
=>
bufferLogService
.
logger
=
logger
);
message
:
string
;
return
bufferLogService
;
}
function
log
(
logger
:
spdlog
.
RotatingLogger
,
level
:
LogLevel
,
message
:
string
):
void
{
switch
(
level
)
{
case
LogLevel
.
Trace
:
return
logger
.
trace
(
message
);
case
LogLevel
.
Debug
:
return
logger
.
debug
(
message
);
case
LogLevel
.
Info
:
return
logger
.
info
(
message
);
case
LogLevel
.
Warning
:
return
logger
.
warn
(
message
);
case
LogLevel
.
Error
:
return
logger
.
error
(
message
);
case
LogLevel
.
Critical
:
return
logger
.
critical
(
message
);
default
:
throw
new
Error
(
'
Invalid log level
'
);
}
}
}
class
SpdLogService
extends
AbstractLogService
implements
ILogService
{
export
class
SpdLogService
extends
AbstractLogService
implements
ILogService
{
_serviceBrand
:
any
;
_serviceBrand
:
any
;
constructor
(
private
buffer
:
ILog
[]
=
[];
private
readonly
logger
:
spdlog
.
RotatingLogger
,
private
_loggerPromise
:
Promise
<
spdlog
.
RotatingLogger
|
null
>
|
undefined
=
undefined
;
level
:
LogLevel
=
LogLevel
.
Error
private
_logger
:
spdlog
.
RotatingLogger
|
undefined
;
)
{
constructor
(
private
readonly
name
:
string
,
private
readonly
logsFolder
:
string
,
level
:
LogLevel
)
{
super
();
super
();
this
.
setLevel
(
level
);
this
.
setLevel
(
level
);
this
.
_createSpdLogLogger
();
this
.
_register
(
this
.
onDidChangeLogLevel
(
level
=>
{
if
(
this
.
_logger
)
{
this
.
_logger
.
setLevel
(
level
);
}
}));
}
private
_createSpdLogLogger
()
{
if
(
!
this
.
_loggerPromise
)
{
this
.
_loggerPromise
=
createSpdLogLogger
(
this
.
name
,
this
.
logsFolder
);
this
.
_loggerPromise
.
then
(
logger
=>
{
if
(
logger
)
{
this
.
_logger
=
logger
;
this
.
_logger
.
setLevel
(
this
.
getLevel
());
for
(
const
{
level
,
message
}
of
this
.
buffer
)
{
log
(
this
.
_logger
,
level
,
message
);
}
}
});
}
this
.
buffer
=
[];
}
private
_log
(
level
:
LogLevel
,
message
:
string
):
void
{
if
(
this
.
_logger
)
{
log
(
this
.
_logger
,
level
,
message
);
}
else
if
(
this
.
getLevel
()
<=
level
)
{
this
.
buffer
.
push
({
level
,
message
});
}
}
}
trace
():
void
{
trace
():
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Trace
)
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Trace
)
{
this
.
logger
.
trace
(
this
.
format
(
arguments
));
this
.
_log
(
LogLevel
.
Trace
,
this
.
format
(
arguments
));
}
}
}
}
debug
():
void
{
debug
():
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Debug
)
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Debug
)
{
this
.
logger
.
debug
(
this
.
format
(
arguments
));
this
.
_log
(
LogLevel
.
Debug
,
this
.
format
(
arguments
));
}
}
}
}
info
():
void
{
info
():
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Info
)
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Info
)
{
this
.
logger
.
info
(
this
.
format
(
arguments
));
this
.
_log
(
LogLevel
.
Info
,
this
.
format
(
arguments
));
}
}
}
}
warn
():
void
{
warn
():
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Warning
)
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Warning
)
{
this
.
logger
.
warn
(
this
.
format
(
arguments
));
this
.
_log
(
LogLevel
.
Warning
,
this
.
format
(
arguments
));
}
}
}
}
...
@@ -78,21 +116,33 @@ class SpdLogService extends AbstractLogService implements ILogService {
...
@@ -78,21 +116,33 @@ class SpdLogService extends AbstractLogService implements ILogService {
if
(
arg
instanceof
Error
)
{
if
(
arg
instanceof
Error
)
{
const
array
=
Array
.
prototype
.
slice
.
call
(
arguments
)
as
any
[];
const
array
=
Array
.
prototype
.
slice
.
call
(
arguments
)
as
any
[];
array
[
0
]
=
arg
.
stack
;
array
[
0
]
=
arg
.
stack
;
this
.
logger
.
error
(
this
.
format
(
array
));
this
.
_log
(
LogLevel
.
Error
,
this
.
format
(
array
));
}
else
{
}
else
{
this
.
logger
.
error
(
this
.
format
(
arguments
));
this
.
_log
(
LogLevel
.
Error
,
this
.
format
(
arguments
));
}
}
}
}
}
}
critical
():
void
{
critical
():
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Critical
)
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Critical
)
{
this
.
logger
.
critical
(
this
.
format
(
arguments
));
this
.
_log
(
LogLevel
.
Critical
,
this
.
format
(
arguments
));
}
}
}
}
dispose
():
void
{
dispose
():
void
{
this
.
logger
.
drop
();
if
(
this
.
_logger
)
{
this
.
disposeLogger
();
}
else
if
(
this
.
_loggerPromise
)
{
this
.
_loggerPromise
.
then
(()
=>
this
.
disposeLogger
());
}
this
.
_loggerPromise
=
undefined
;
}
private
disposeLogger
():
void
{
if
(
this
.
_logger
)
{
this
.
_logger
.
drop
();
this
.
_logger
=
undefined
;
}
}
}
private
format
(
args
:
any
):
string
{
private
format
(
args
:
any
):
string
{
...
...
src/vs/workbench/electron-browser/main.ts
浏览文件 @
4026f653
...
@@ -23,7 +23,6 @@ import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron
...
@@ -23,7 +23,6 @@ import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron
import
{
IWindowConfiguration
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowConfiguration
}
from
'
vs/platform/windows/common/windows
'
;
import
{
webFrame
}
from
'
electron
'
;
import
{
webFrame
}
from
'
electron
'
;
import
{
ISingleFolderWorkspaceIdentifier
,
IWorkspaceInitializationPayload
,
ISingleFolderWorkspaceInitializationPayload
,
reviveWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
ISingleFolderWorkspaceIdentifier
,
IWorkspaceInitializationPayload
,
ISingleFolderWorkspaceInitializationPayload
,
reviveWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
createBufferSpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
ConsoleLogService
,
MultiplexLogService
,
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ConsoleLogService
,
MultiplexLogService
,
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
StorageService
}
from
'
vs/platform/storage/node/storageService
'
;
import
{
StorageService
}
from
'
vs/platform/storage/node/storageService
'
;
import
{
LogLevelSetterChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/node/logIpc
'
;
import
{
LogLevelSetterChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/node/logIpc
'
;
...
@@ -49,6 +48,7 @@ import { REMOTE_FILE_SYSTEM_CHANNEL_NAME, RemoteExtensionsFileSystemProvider } f
...
@@ -49,6 +48,7 @@ import { REMOTE_FILE_SYSTEM_CHANNEL_NAME, RemoteExtensionsFileSystemProvider } f
import
{
DefaultConfigurationExportHelper
}
from
'
vs/workbench/services/configuration/node/configurationExportHelper
'
;
import
{
DefaultConfigurationExportHelper
}
from
'
vs/workbench/services/configuration/node/configurationExportHelper
'
;
import
{
ConfigurationCache
}
from
'
vs/workbench/services/configuration/node/configurationCache
'
;
import
{
ConfigurationCache
}
from
'
vs/workbench/services/configuration/node/configurationCache
'
;
import
{
ConfigurationFileService
}
from
'
vs/workbench/services/configuration/node/configurationFileService
'
;
import
{
ConfigurationFileService
}
from
'
vs/workbench/services/configuration/node/configurationFileService
'
;
import
{
SpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
class
CodeRendererMain
extends
Disposable
{
class
CodeRendererMain
extends
Disposable
{
...
@@ -334,7 +334,7 @@ class CodeRendererMain extends Disposable {
...
@@ -334,7 +334,7 @@ class CodeRendererMain extends Disposable {
}
}
private
createLogService
(
mainProcessService
:
IMainProcessService
,
environmentService
:
IWorkbenchEnvironmentService
):
ILogService
{
private
createLogService
(
mainProcessService
:
IMainProcessService
,
environmentService
:
IWorkbenchEnvironmentService
):
ILogService
{
const
spdlogService
=
createBufferSpdLogService
(
`renderer
${
this
.
configuration
.
windowId
}
`
,
this
.
configuration
.
logLevel
,
environmentService
.
logsPath
);
const
spdlogService
=
new
SpdLogService
(
`renderer
${
this
.
configuration
.
windowId
}
`
,
environmentService
.
logsPath
,
this
.
configuration
.
logLevel
);
const
consoleLogService
=
new
ConsoleLogService
(
this
.
configuration
.
logLevel
);
const
consoleLogService
=
new
ConsoleLogService
(
this
.
configuration
.
logLevel
);
const
logService
=
new
MultiplexLogService
([
consoleLogService
,
spdlogService
]);
const
logService
=
new
MultiplexLogService
([
consoleLogService
,
spdlogService
]);
const
logLevelClient
=
new
LogLevelSetterChannelClient
(
mainProcessService
.
getChannel
(
'
loglevel
'
));
const
logLevelClient
=
new
LogLevelSetterChannelClient
(
mainProcessService
.
getChannel
(
'
loglevel
'
));
...
...
src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
浏览文件 @
4026f653
...
@@ -16,12 +16,12 @@ import { IInitData, MainThreadConsoleShape } from 'vs/workbench/api/common/extHo
...
@@ -16,12 +16,12 @@ import { IInitData, MainThreadConsoleShape } from 'vs/workbench/api/common/extHo
import
{
MessageType
,
createMessageOfType
,
isMessageOfType
,
IExtHostSocketMessage
,
IExtHostReadyMessage
}
from
'
vs/workbench/services/extensions/common/extensionHostProtocol
'
;
import
{
MessageType
,
createMessageOfType
,
isMessageOfType
,
IExtHostSocketMessage
,
IExtHostReadyMessage
}
from
'
vs/workbench/services/extensions/common/extensionHostProtocol
'
;
import
{
ExtensionHostMain
,
IExitFn
,
ILogServiceFn
}
from
'
vs/workbench/services/extensions/node/extensionHostMain
'
;
import
{
ExtensionHostMain
,
IExitFn
,
ILogServiceFn
}
from
'
vs/workbench/services/extensions/node/extensionHostMain
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
import
{
createBufferSpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
ExtensionHostLogFileName
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ExtensionHostLogFileName
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
IURITransformer
,
URITransformer
,
IRawURITransformer
}
from
'
vs/base/common/uriIpc
'
;
import
{
IURITransformer
,
URITransformer
,
IRawURITransformer
}
from
'
vs/base/common/uriIpc
'
;
import
{
exists
}
from
'
vs/base/node/pfs
'
;
import
{
exists
}
from
'
vs/base/node/pfs
'
;
import
{
realpath
}
from
'
vs/base/node/extpath
'
;
import
{
realpath
}
from
'
vs/base/node/extpath
'
;
import
{
IHostUtils
}
from
'
vs/workbench/api/node/extHostExtensionService
'
;
import
{
IHostUtils
}
from
'
vs/workbench/api/node/extHostExtensionService
'
;
import
{
SpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
interface
ParsedExtHostArgs
{
interface
ParsedExtHostArgs
{
uriTransformerPath
?:
string
;
uriTransformerPath
?:
string
;
...
@@ -82,7 +82,7 @@ function patchPatchedConsole(mainThreadConsole: MainThreadConsoleShape): void {
...
@@ -82,7 +82,7 @@ function patchPatchedConsole(mainThreadConsole: MainThreadConsoleShape): void {
};
};
}
}
const
createLogService
:
ILogServiceFn
=
initData
=>
createBufferSpdLogService
(
ExtensionHostLogFileName
,
initData
.
logLevel
,
initData
.
logsLocation
.
fsPath
);
const
createLogService
:
ILogServiceFn
=
initData
=>
new
SpdLogService
(
ExtensionHostLogFileName
,
initData
.
logsLocation
.
fsPath
,
initData
.
logLevel
);
interface
IRendererConnection
{
interface
IRendererConnection
{
protocol
:
IMessagePassingProtocol
;
protocol
:
IMessagePassingProtocol
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录