Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
2b5d14e4
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 搜索 >>
提交
2b5d14e4
编写于
11月 29, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drop global log service
上级
d21eb1ad
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
44 addition
and
38 deletion
+44
-38
src/vs/platform/commands/common/commandService.ts
src/vs/platform/commands/common/commandService.ts
+4
-2
src/vs/platform/commands/test/commandService.test.ts
src/vs/platform/commands/test/commandService.test.ts
+17
-5
src/vs/platform/log/common/log.ts
src/vs/platform/log/common/log.ts
+9
-15
src/vs/platform/log/node/spdlogService.ts
src/vs/platform/log/node/spdlogService.ts
+7
-12
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+2
-2
src/vs/workbench/services/scm/common/scmService.ts
src/vs/workbench/services/scm/common/scmService.ts
+5
-2
未找到文件。
src/vs/platform/commands/common/commandService.ts
浏览文件 @
2b5d14e4
...
...
@@ -11,7 +11,7 @@ import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
log
,
LogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
log
,
LogLevel
,
ILogService
}
from
'
vs/platform/log/common/log
'
;
export
class
CommandService
extends
Disposable
implements
ICommandService
{
...
...
@@ -25,7 +25,9 @@ export class CommandService extends Disposable implements ICommandService {
constructor
(
@
IInstantiationService
private
_instantiationService
:
IInstantiationService
,
@
IExtensionService
private
_extensionService
:
IExtensionService
,
@
IContextKeyService
private
_contextKeyService
:
IContextKeyService
@
IContextKeyService
private
_contextKeyService
:
IContextKeyService
,
// @ts-ignore
@
ILogService
private
logService
:
ILogService
)
{
super
();
this
.
_extensionService
.
whenInstalledExtensionsRegistered
().
then
(
value
=>
this
.
_extensionHostIsReady
=
value
);
...
...
src/vs/platform/commands/test/commandService.test.ts
浏览文件 @
2b5d14e4
...
...
@@ -16,6 +16,17 @@ import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyServ
import
{
SimpleConfigurationService
}
from
'
vs/editor/standalone/browser/simpleServices
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
class
NoopLogService
implements
ILogService
{
_serviceBrand
:
any
;
trace
(
message
:
string
,
...
args
:
any
[]):
void
{
}
debug
(
message
:
string
,
...
args
:
any
[]):
void
{
}
info
(
message
:
string
,
...
args
:
any
[]):
void
{
}
warn
(
message
:
string
,
...
args
:
any
[]):
void
{
}
error
(
message
:
string
|
Error
,
...
args
:
any
[]):
void
{
}
critical
(
message
:
string
|
Error
,
...
args
:
any
[]):
void
{
}
}
class
SimpleExtensionService
implements
IExtensionService
{
_serviceBrand
:
any
;
...
...
@@ -70,7 +81,7 @@ suite('CommandService', function () {
lastEvent
=
activationEvent
;
return
super
.
activateByEvent
(
activationEvent
);
}
},
new
ContextKeyService
(
new
SimpleConfigurationService
()));
},
new
ContextKeyService
(
new
SimpleConfigurationService
())
,
new
NoopLogService
()
);
return
service
.
executeCommand
(
'
foo
'
).
then
(()
=>
{
assert
.
ok
(
lastEvent
,
'
onCommand:foo
'
);
...
...
@@ -88,7 +99,7 @@ suite('CommandService', function () {
activateByEvent
(
activationEvent
:
string
):
TPromise
<
void
>
{
return
TPromise
.
wrapError
<
void
>
(
new
Error
(
'
bad_activate
'
));
}
},
new
ContextKeyService
(
new
SimpleConfigurationService
()));
},
new
ContextKeyService
(
new
SimpleConfigurationService
())
,
new
NoopLogService
()
);
return
service
.
executeCommand
(
'
foo
'
).
then
(()
=>
assert
.
ok
(
false
),
err
=>
{
assert
.
equal
(
err
.
message
,
'
bad_activate
'
);
...
...
@@ -104,7 +115,7 @@ suite('CommandService', function () {
whenInstalledExtensionsRegistered
()
{
return
new
TPromise
<
boolean
>
(
_resolve
=>
{
/*ignore*/
});
}
},
new
ContextKeyService
(
new
SimpleConfigurationService
()));
},
new
ContextKeyService
(
new
SimpleConfigurationService
())
,
new
NoopLogService
()
);
service
.
executeCommand
(
'
bar
'
);
assert
.
equal
(
callCounter
,
1
);
...
...
@@ -121,7 +132,7 @@ suite('CommandService', function () {
whenInstalledExtensionsRegistered
()
{
return
new
TPromise
<
boolean
>
(
_resolve
=>
{
resolveFunc
=
_resolve
;
});
}
},
new
ContextKeyService
(
new
SimpleConfigurationService
()));
},
new
ContextKeyService
(
new
SimpleConfigurationService
())
,
new
NoopLogService
()
);
let
r
=
service
.
executeCommand
(
'
bar
'
);
assert
.
equal
(
callCounter
,
0
);
...
...
@@ -140,7 +151,8 @@ suite('CommandService', function () {
let
commandService
=
new
CommandService
(
new
InstantiationService
(),
new
SimpleExtensionService
(),
contextKeyService
contextKeyService
,
new
NoopLogService
()
);
let
counter
=
0
;
...
...
src/vs/platform/log/common/log.ts
浏览文件 @
2b5d14e4
...
...
@@ -67,28 +67,22 @@ export class LegacyLogMainService implements ILogService {
}
}
export
let
globalLogService
:
ILogService
|
undefined
;
export
function
setGlobalLogService
(
logService
:
ILogService
):
void
{
globalLogService
=
logService
;
}
export
function
log
(
level
:
LogLevel
,
prefix
:
string
,
fn
?:
(...
args
:
any
[])
=>
string
):
Function
{
export
function
log
(
level
:
LogLevel
,
prefix
:
string
,
logFn
?:
(
message
:
string
,
...
args
:
any
[])
=>
string
):
Function
{
return
createDecorator
((
fn
,
key
)
=>
{
return
function
(
this
:
any
,
...
args
:
any
[])
{
let
message
=
`
${
prefix
}
-
${
key
}
`
;
if
(
f
n
)
{
message
=
f
n
(
message
,
...
args
);
if
(
logF
n
)
{
message
=
logF
n
(
message
,
...
args
);
}
switch
(
level
)
{
case
LogLevel
.
TRACE
:
globalLogService
.
trace
(
message
)
;
case
LogLevel
.
DEBUG
:
globalLogService
.
debug
(
message
)
;
case
LogLevel
.
INFO
:
globalLogService
.
info
(
message
)
;
case
LogLevel
.
WARN
:
globalLogService
.
warn
(
message
)
;
case
LogLevel
.
ERROR
:
globalLogService
.
error
(
message
)
;
case
LogLevel
.
CRITICAL
:
globalLogService
.
critical
(
message
)
;
case
LogLevel
.
TRACE
:
this
.
logService
.
trace
(
message
);
break
;
case
LogLevel
.
DEBUG
:
this
.
logService
.
debug
(
message
);
break
;
case
LogLevel
.
INFO
:
this
.
logService
.
info
(
message
);
break
;
case
LogLevel
.
WARN
:
this
.
logService
.
warn
(
message
);
break
;
case
LogLevel
.
ERROR
:
this
.
logService
.
error
(
message
);
break
;
case
LogLevel
.
CRITICAL
:
this
.
logService
.
critical
(
message
);
break
;
}
return
fn
.
apply
(
this
,
args
);
...
...
src/vs/platform/log/node/spdlogService.ts
浏览文件 @
2b5d14e4
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
ILogService
,
setGlobalLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
export
class
SpdLogService
implements
ILogService
{
...
...
@@ -14,37 +14,32 @@ export class SpdLogService implements ILogService {
constructor
(
processName
:
string
,
setGlobal
:
boolean
,
@
IEnvironmentService
environmentService
:
IEnvironmentService
)
{
// TODO create logger
if
(
setGlobal
)
{
setGlobalLogService
(
this
);
}
}
trace
(
message
:
string
,
...
args
:
any
[]):
void
{
// throw new Error('Method not implemented.'
);
console
.
log
(
'
TRACE
'
,
message
,
...
args
);
}
debug
(
message
:
string
,
...
args
:
any
[]):
void
{
// throw new Error('Method not implemented.'
);
console
.
log
(
'
DEBUG
'
,
message
,
...
args
);
}
info
(
message
:
string
,
...
args
:
any
[]):
void
{
// throw new Error('Method not implemented.'
);
console
.
log
(
'
INFO
'
,
message
,
...
args
);
}
warn
(
message
:
string
,
...
args
:
any
[]):
void
{
// throw new Error('Method not implemented.'
);
console
.
warn
(
'
WARN
'
,
message
,
...
args
);
}
error
(
message
:
string
|
Error
,
...
args
:
any
[]):
void
{
// throw new Error('Method not implemented.'
);
console
.
error
(
'
ERROR
'
,
message
,
...
args
);
}
critical
(
message
:
string
,
...
args
:
any
[]):
void
{
// throw new Error('Method not implemented.'
);
console
.
error
(
'
CRITICAL
'
,
message
,
...
args
);
}
}
\ No newline at end of file
src/vs/workbench/electron-browser/main.ts
浏览文件 @
2b5d14e4
...
...
@@ -73,8 +73,8 @@ function openWorkbench(configuration: IWindowConfiguration): TPromise<void> {
const
mainServices
=
createMainProcessServices
(
mainProcessClient
);
const
environmentService
=
new
EnvironmentService
(
configuration
,
configuration
.
execPath
);
const
logService
=
new
SpdLogService
(
'
renderer
'
,
true
,
environmentService
);
logService
.
info
(
'
openWorkbench
'
,
JSON
.
stringify
(
configuration
,
null
,
2
));
const
logService
=
new
SpdLogService
(
'
renderer
'
,
environmentService
);
logService
.
info
(
'
openWorkbench
'
,
JSON
.
stringify
(
configuration
));
// Since the configuration service is one of the core services that is used in so many places, we initialize it
// right before startup of the workbench shell to have its data ready for consumers
...
...
src/vs/workbench/services/scm/common/scmService.ts
浏览文件 @
2b5d14e4
...
...
@@ -8,7 +8,7 @@
import
{
IDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ISCMService
,
ISCMProvider
,
ISCMInput
,
ISCMRepository
}
from
'
./scm
'
;
import
{
log
,
LogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
log
,
LogLevel
,
ILogService
}
from
'
vs/platform/log/common/log
'
;
class
SCMInput
implements
ISCMInput
{
...
...
@@ -77,7 +77,10 @@ export class SCMService implements ISCMService {
private
_onDidRemoveProvider
=
new
Emitter
<
ISCMRepository
>
();
get
onDidRemoveRepository
():
Event
<
ISCMRepository
>
{
return
this
.
_onDidRemoveProvider
.
event
;
}
constructor
()
{
}
constructor
(
// @ts-ignore
@
ILogService
private
logService
:
ILogService
)
{
}
@
log
(
LogLevel
.
INFO
,
'
SCMService
'
)
registerSCMProvider
(
provider
:
ISCMProvider
):
ISCMRepository
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录