Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9f38b4e8
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,发现更多精彩内容 >>
提交
9f38b4e8
编写于
8月 22, 2019
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fallback in memory log provider and add console logging
上级
df2e0c71
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
19 deletion
+22
-19
src/vs/workbench/browser/web.main.ts
src/vs/workbench/browser/web.main.ts
+17
-5
src/vs/workbench/services/log/browser/indexedDBLogProvider.ts
...vs/workbench/services/log/browser/indexedDBLogProvider.ts
+5
-7
src/vs/workbench/services/log/common/inMemoryLogProvider.ts
src/vs/workbench/services/log/common/inMemoryLogProvider.ts
+0
-7
未找到文件。
src/vs/workbench/browser/web.main.ts
浏览文件 @
9f38b4e8
...
...
@@ -6,7 +6,7 @@
import
{
mark
}
from
'
vs/base/common/performance
'
;
import
{
domContentLoaded
,
addDisposableListener
,
EventType
,
addClass
}
from
'
vs/base/browser/dom
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
,
ConsoleLogService
,
MultiplexLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
BrowserWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/browser/environmentService
'
;
import
{
Workbench
}
from
'
vs/workbench/browser/workbench
'
;
...
...
@@ -44,7 +44,8 @@ import { StaticExtensionsService, IStaticExtensionsService } from 'vs/workbench/
import
{
BufferLogService
}
from
'
vs/platform/log/common/bufferLog
'
;
import
{
FileLogService
}
from
'
vs/platform/log/common/fileLogService
'
;
import
{
toLocalISOString
}
from
'
vs/base/common/date
'
;
import
{
INDEXEDDB_LOG_SCHEME
,
IndexedDBLogProvider
}
from
'
vs/workbench/services/log/browser/indexedDBLogProvider
'
;
import
{
IndexedDBLogProvider
}
from
'
vs/workbench/services/log/browser/indexedDBLogProvider
'
;
import
{
InMemoryLogProvider
}
from
'
vs/workbench/services/log/common/inMemoryLogProvider
'
;
class
CodeRendererMain
extends
Disposable
{
...
...
@@ -120,7 +121,7 @@ class CodeRendererMain extends Disposable {
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Log
const
logsPath
=
URI
.
file
(
toLocalISOString
(
new
Date
()).
replace
(
/-|:|
\.\d
+Z$/g
,
''
)).
with
({
scheme
:
INDEXEDDB_LOG_SCHEME
});
const
logsPath
=
URI
.
file
(
toLocalISOString
(
new
Date
()).
replace
(
/-|:|
\.\d
+Z$/g
,
''
)).
with
({
scheme
:
'
vscode-log
'
});
const
logService
=
new
BufferLogService
();
serviceCollection
.
set
(
ILogService
,
logService
);
...
...
@@ -151,8 +152,19 @@ class CodeRendererMain extends Disposable {
serviceCollection
.
set
(
IFileService
,
fileService
);
// Logger
fileService
.
registerProvider
(
INDEXEDDB_LOG_SCHEME
,
new
IndexedDBLogProvider
());
logService
.
logger
=
new
FileLogService
(
'
window
'
,
environmentService
.
logFile
,
logService
.
getLevel
(),
fileService
);
const
indexedDBLogProvider
=
new
IndexedDBLogProvider
(
logsPath
.
scheme
);
indexedDBLogProvider
.
database
.
then
(
()
=>
fileService
.
registerProvider
(
logsPath
.
scheme
,
indexedDBLogProvider
),
e
=>
{
(
<
ILogService
>
logService
).
info
(
'
Error while creating indexedDB log provider. Falling back to in memory log provider.
'
);
(
<
ILogService
>
logService
).
error
(
e
);
fileService
.
registerProvider
(
logsPath
.
scheme
,
new
InMemoryLogProvider
(
logsPath
.
scheme
));
}
).
then
(()
=>
{
const
consoleLogService
=
new
ConsoleLogService
(
logService
.
getLevel
());
const
fileLogService
=
new
FileLogService
(
'
window
'
,
environmentService
.
logFile
,
logService
.
getLevel
(),
fileService
);
logService
.
logger
=
new
MultiplexLogService
([
consoleLogService
,
fileLogService
]);
});
// Static Extensions
const
staticExtensions
=
new
StaticExtensionsService
(
this
.
configuration
.
staticExtensions
||
[]);
...
...
src/vs/workbench/services/log/browser/indexedDBLogProvider.ts
浏览文件 @
9f38b4e8
...
...
@@ -5,23 +5,21 @@
import
{
KeyValueLogProvider
}
from
'
vs/workbench/services/log/common/keyValueLogProvider
'
;
export
const
INDEXEDDB_LOG_SCHEME
=
'
vscode-logs-indexedbd
'
;
export
const
INDEXEDDB_LOGS_DB
=
'
vscode-logs-db
'
;
export
const
INDEXEDDB_VSCODE_DB
=
'
vscode-web-db
'
;
export
const
INDEXEDDB_LOGS_OBJECT_STORE
=
'
vscode-logs-store
'
;
export
class
IndexedDBLogProvider
extends
KeyValueLogProvider
{
private
readonly
database
:
Promise
<
IDBDatabase
>
;
readonly
database
:
Promise
<
IDBDatabase
>
;
constructor
(
)
{
super
(
INDEXEDDB_LOG_SCHEME
);
constructor
(
scheme
:
string
)
{
super
(
scheme
);
this
.
database
=
this
.
openDatabase
(
1
);
}
private
openDatabase
(
version
:
number
):
Promise
<
IDBDatabase
>
{
return
new
Promise
((
c
,
e
)
=>
{
const
request
=
window
.
indexedDB
.
open
(
INDEXEDDB_
LOGS
_DB
,
version
);
const
request
=
window
.
indexedDB
.
open
(
INDEXEDDB_
VSCODE
_DB
,
version
);
request
.
onerror
=
(
err
)
=>
e
(
request
.
error
);
request
.
onsuccess
=
()
=>
{
const
db
=
request
.
result
;
...
...
src/vs/workbench/services/log/common/inMemoryLogProvider.ts
浏览文件 @
9f38b4e8
...
...
@@ -6,17 +6,10 @@
import
{
KeyValueLogProvider
}
from
'
vs/workbench/services/log/common/keyValueLogProvider
'
;
import
{
keys
}
from
'
vs/base/common/map
'
;
export
const
INMEMORY_LOG_SCHEME
=
'
vscode-logs-inmemory
'
;
export
class
InMemoryLogProvider
extends
KeyValueLogProvider
{
private
readonly
logs
:
Map
<
string
,
string
>
=
new
Map
<
string
,
string
>
();
constructor
(
)
{
super
(
INMEMORY_LOG_SCHEME
);
}
protected
async
getAllKeys
():
Promise
<
string
[]
>
{
return
keys
(
this
.
logs
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录