Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9ec76f9c
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,发现更多精彩内容 >>
提交
9ec76f9c
编写于
8月 22, 2019
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
logs data clean up
上级
77c1e7fa
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
58 addition
and
7 deletion
+58
-7
src/vs/workbench/contrib/logs/common/logs.contribution.ts
src/vs/workbench/contrib/logs/common/logs.contribution.ts
+5
-1
src/vs/workbench/contrib/logs/common/logsDataCleaner.ts
src/vs/workbench/contrib/logs/common/logsDataCleaner.ts
+44
-0
src/vs/workbench/services/environment/browser/environmentService.ts
...kbench/services/environment/browser/environmentService.ts
+1
-1
src/vs/workbench/services/log/browser/indexedDBLogProvider.ts
...vs/workbench/services/log/browser/indexedDBLogProvider.ts
+8
-5
未找到文件。
src/vs/workbench/contrib/logs/common/logs.contribution.ts
浏览文件 @
9ec76f9c
...
...
@@ -20,6 +20,8 @@ import { ILogService, LogLevel } from 'vs/platform/log/common/log';
import
{
dirname
}
from
'
vs/base/common/resources
'
;
import
{
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
isWeb
}
from
'
vs/base/common/platform
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
LogsDataCleaner
}
from
'
vs/workbench/contrib/logs/common/logsDataCleaner
'
;
const
workbenchActionsRegistry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
WorkbenchActionExtensions
.
WorkbenchActions
);
const
devCategory
=
nls
.
localize
(
'
developer
'
,
"
Developer
"
);
...
...
@@ -30,7 +32,8 @@ class LogOutputChannels extends Disposable implements IWorkbenchContribution {
constructor
(
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
,
@
ILogService
private
readonly
logService
:
ILogService
,
@
IFileService
private
readonly
fileService
:
IFileService
@
IFileService
private
readonly
fileService
:
IFileService
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
)
{
super
();
if
(
isWeb
)
{
...
...
@@ -42,6 +45,7 @@ class LogOutputChannels extends Disposable implements IWorkbenchContribution {
private
registerWebContributions
():
void
{
Registry
.
as
<
IOutputChannelRegistry
>
(
OutputExt
.
OutputChannels
).
registerChannel
({
id
:
Constants
.
rendererLogChannelId
,
label
:
nls
.
localize
(
'
rendererLog
'
,
"
Window
"
),
file
:
this
.
environmentService
.
logFile
,
log
:
true
});
this
.
instantiationService
.
createInstance
(
LogsDataCleaner
);
}
private
registerNativeContributions
():
void
{
...
...
src/vs/workbench/contrib/logs/common/logsDataCleaner.ts
0 → 100644
浏览文件 @
9ec76f9c
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
basename
,
dirname
}
from
'
vs/base/common/resources
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
export
class
LogsDataCleaner
extends
Disposable
{
constructor
(
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
,
@
IFileService
private
readonly
fileService
:
IFileService
,
@
ILifecycleService
private
readonly
lifecycleService
:
ILifecycleService
,
)
{
super
();
this
.
cleanUpOldLogsSoon
();
}
private
cleanUpOldLogsSoon
():
void
{
let
handle
:
NodeJS
.
Timeout
|
undefined
=
setTimeout
(
async
()
=>
{
handle
=
undefined
;
const
logsPath
=
URI
.
file
(
this
.
environmentService
.
logsPath
).
with
({
scheme
:
this
.
environmentService
.
logFile
.
scheme
});
const
stat
=
await
this
.
fileService
.
resolve
(
dirname
(
logsPath
));
if
(
stat
.
children
)
{
const
currentLog
=
basename
(
logsPath
);
const
allSessions
=
stat
.
children
.
filter
(
stat
=>
stat
.
isDirectory
&&
/^
\d{8}
T
\d{6}
$/
.
test
(
stat
.
name
));
const
oldSessions
=
allSessions
.
sort
().
filter
((
d
,
i
)
=>
d
.
name
!==
currentLog
);
const
toDelete
=
oldSessions
.
slice
(
0
,
Math
.
max
(
0
,
oldSessions
.
length
-
49
));
Promise
.
all
(
toDelete
.
map
(
stat
=>
this
.
fileService
.
del
(
stat
.
resource
,
{
recursive
:
true
})));
}
},
10
*
1000
);
this
.
lifecycleService
.
onWillShutdown
(()
=>
{
if
(
handle
)
{
clearTimeout
(
handle
);
handle
=
undefined
;
}
});
}
}
src/vs/workbench/services/environment/browser/environmentService.ts
浏览文件 @
9ec76f9c
...
...
@@ -76,7 +76,7 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
constructor
(
readonly
options
:
IBrowserWorkbenchEnvironemntConstructionOptions
)
{
this
.
args
=
{
_
:
[]
};
this
.
logsPath
=
options
.
logsPath
.
path
;
this
.
logFile
=
joinPath
(
options
.
logsPath
,
`window-
${
generateUuid
()}
`
);
this
.
logFile
=
joinPath
(
options
.
logsPath
,
`window-
${
generateUuid
()}
.log
`
);
this
.
appRoot
=
'
/web/
'
;
this
.
appNameLong
=
'
Visual Studio Code - Web
'
;
...
...
src/vs/workbench/services/log/browser/indexedDBLogProvider.ts
浏览文件 @
9ec76f9c
...
...
@@ -9,7 +9,7 @@ import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
import
{
FileSystemError
}
from
'
vs/workbench/api/common/extHostTypes
'
;
import
{
isEqualOrParent
,
joinPath
}
from
'
vs/base/common/resources
'
;
import
{
isEqualOrParent
,
joinPath
,
relativePath
}
from
'
vs/base/common/resources
'
;
const
LOGS_OBJECT_STORE
=
'
logs
'
;
export
const
INDEXEDDB_LOG_SCHEME
=
'
vscode-logs-indexedbd
'
;
...
...
@@ -95,11 +95,14 @@ export class IndexedDBLogProvider extends Disposable implements IFileSystemProvi
request
.
onerror
=
()
=>
e
(
request
.
error
);
request
.
onsuccess
=
()
=>
{
const
files
:
[
string
,
FileType
][]
=
[];
const
resourceSegments
=
resource
.
path
.
split
(
'
/
'
);
for
(
const
key
of
<
string
[]
>
request
.
result
)
{
if
(
isEqualOrParent
(
URI
.
file
(
key
).
with
({
scheme
:
INDEXEDDB_LOG_SCHEME
}),
resource
,
false
))
{
const
keySegments
=
key
.
split
(
'
/
'
);
files
.
push
([
keySegments
[
resourceSegments
.
length
],
resourceSegments
.
length
+
1
===
keySegments
.
length
?
FileType
.
File
:
FileType
.
Directory
]);
const
keyResource
=
this
.
toResource
(
key
);
if
(
isEqualOrParent
(
keyResource
,
resource
,
false
))
{
const
path
=
relativePath
(
resource
,
keyResource
,
false
);
if
(
path
)
{
const
keySegments
=
path
.
split
(
'
/
'
);
files
.
push
([
keySegments
[
0
],
keySegments
.
length
===
1
?
FileType
.
File
:
FileType
.
Directory
]);
}
}
}
c
(
files
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录