Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
594b8b8d
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 搜索 >>
提交
594b8b8d
编写于
4月 26, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
workaround #47883
上级
8c1cc70d
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
40 addition
and
5 deletion
+40
-5
src/vs/platform/log/common/log.ts
src/vs/platform/log/common/log.ts
+25
-0
src/vs/platform/log/node/spdlogService.ts
src/vs/platform/log/node/spdlogService.ts
+11
-1
src/vs/workbench/parts/output/electron-browser/outputServices.ts
...workbench/parts/output/electron-browser/outputServices.ts
+4
-4
未找到文件。
src/vs/platform/log/common/log.ts
浏览文件 @
594b8b8d
...
...
@@ -300,6 +300,31 @@ export class NullLogService implements ILogService {
dispose
():
void
{
}
}
export
interface
IOutputWriter
{
trace
(
message
:
string
):
void
;
debug
(
message
:
string
):
void
;
info
(
message
:
string
):
void
;
warn
(
message
:
string
):
void
;
error
(
message
:
string
):
void
;
critical
(
message
:
string
):
void
;
setLevel
(
level
:
number
):
void
;
clearFormatters
():
void
;
flush
():
void
;
drop
():
void
;
}
export
class
NullOutputWriter
implements
IOutputWriter
{
trace
(
message
:
string
):
void
{
}
debug
(
message
:
string
):
void
{
}
info
(
message
:
string
):
void
{
}
warn
(
message
:
string
):
void
{
}
error
(
message
:
string
):
void
{
}
critical
(
message
:
string
):
void
{
}
setLevel
(
level
:
number
):
void
{
}
clearFormatters
():
void
{
}
flush
():
void
{
}
drop
():
void
{
}
}
export
function
getLogLevel
(
environmentService
:
IEnvironmentService
):
LogLevel
{
if
(
environmentService
.
verbose
)
{
...
...
src/vs/platform/log/node/spdlogService.ts
浏览文件 @
594b8b8d
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
*
as
path
from
'
path
'
;
import
{
ILogService
,
LogLevel
,
NullLogService
,
AbstractLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
,
LogLevel
,
NullLogService
,
AbstractLogService
,
NullOutputWriter
,
IOutputWriter
}
from
'
vs/platform/log/common/log
'
;
import
*
as
spdlog
from
'
spdlog
'
;
export
function
createSpdLogService
(
processName
:
string
,
logLevel
:
LogLevel
,
logsFolder
:
string
):
ILogService
{
...
...
@@ -25,6 +25,16 @@ export function createSpdLogService(processName: string, logLevel: LogLevel, log
return
new
NullLogService
();
}
export
function
createSpdLogOutputWriter
(
name
:
string
,
filename
:
string
,
filesize
:
number
,
filecount
:
number
):
IOutputWriter
{
// Do not crash if spdlog rotating logger cannot be loaded (workaround for https://github.com/Microsoft/vscode/issues/47883)
try
{
return
new
spdlog
.
RotatingLogger
(
name
,
filename
,
filesize
,
filecount
);
}
catch
(
e
)
{
console
.
error
(
e
);
}
return
new
NullOutputWriter
();
}
class
SpdLogService
extends
AbstractLogService
implements
ILogService
{
_serviceBrand
:
any
;
...
...
src/vs/workbench/parts/output/electron-browser/outputServices.ts
浏览文件 @
594b8b8d
...
...
@@ -31,13 +31,13 @@ import { IFileService } from 'vs/platform/files/common/files';
import
{
IPanel
}
from
'
vs/workbench/common/panel
'
;
import
{
ResourceEditorInput
}
from
'
vs/workbench/common/editor/resourceEditorInput
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
RotatingLogger
}
from
'
spdlog
'
;
import
{
toLocalISOString
}
from
'
vs/base/common/date
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
,
IOutputWriter
}
from
'
vs/platform/log/common/log
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
createSpdLogOutputWriter
}
from
'
vs/platform/log/node/spdlogService
'
;
const
OUTPUT_ACTIVE_CHANNEL_KEY
=
'
output.activechannel
'
;
...
...
@@ -201,7 +201,7 @@ abstract class AbstractFileOutputChannel extends Disposable {
*/
class
OutputChannelBackedByFile
extends
AbstractFileOutputChannel
implements
OutputChannel
{
private
outputWriter
:
RotatingLogg
er
;
private
outputWriter
:
IOutputWrit
er
;
private
appendedMessage
=
''
;
private
loadingFromFileInProgress
:
boolean
=
false
;
private
resettingDelayer
:
ThrottledDelayer
<
void
>
;
...
...
@@ -219,7 +219,7 @@ class OutputChannelBackedByFile extends AbstractFileOutputChannel implements Out
super
({
...
outputChannelIdentifier
,
file
:
URI
.
file
(
paths
.
join
(
outputDir
,
`
${
outputChannelIdentifier
.
id
}
.log`
))
},
modelUri
,
OUTPUT_MIME
,
fileService
,
modelService
,
modeService
);
// Use one rotating file to check for main file reset
this
.
outputWriter
=
new
RotatingLogg
er
(
this
.
id
,
this
.
file
.
fsPath
,
1024
*
1024
*
30
,
1
);
this
.
outputWriter
=
createSpdLogOutputWrit
er
(
this
.
id
,
this
.
file
.
fsPath
,
1024
*
1024
*
30
,
1
);
this
.
outputWriter
.
clearFormatters
();
this
.
rotatingFilePath
=
`
${
outputChannelIdentifier
.
id
}
.1.log`
;
this
.
_register
(
watchOutputDirectory
(
paths
.
dirname
(
this
.
file
.
fsPath
),
logService
,
(
eventType
,
file
)
=>
this
.
onFileChangedInOutputDirector
(
eventType
,
file
)));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录