Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
d21eb1ad
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
d21eb1ad
编写于
11月 29, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
log decorator
上级
4cc2dfea
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
52 addition
and
4 deletion
+52
-4
src/vs/platform/commands/common/commandService.ts
src/vs/platform/commands/common/commandService.ts
+2
-0
src/vs/platform/log/common/log.ts
src/vs/platform/log/common/log.ts
+41
-2
src/vs/platform/log/node/spdlogService.ts
src/vs/platform/log/node/spdlogService.ts
+6
-1
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+1
-1
src/vs/workbench/services/scm/common/scmService.ts
src/vs/workbench/services/scm/common/scmService.ts
+2
-0
未找到文件。
src/vs/platform/commands/common/commandService.ts
浏览文件 @
d21eb1ad
...
...
@@ -11,6 +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
'
;
export
class
CommandService
extends
Disposable
implements
ICommandService
{
...
...
@@ -30,6 +31,7 @@ export class CommandService extends Disposable implements ICommandService {
this
.
_extensionService
.
whenInstalledExtensionsRegistered
().
then
(
value
=>
this
.
_extensionHostIsReady
=
value
);
}
@
log
(
LogLevel
.
INFO
,
'
CommandService
'
,
(
msg
,
id
)
=>
`
${
msg
}
(
${
id
}
)`
)
executeCommand
<
T
>
(
id
:
string
,
...
args
:
any
[]):
TPromise
<
T
>
{
// we always send an activation event, but
// we don't wait for it when the extension
...
...
src/vs/platform/log/common/log.ts
浏览文件 @
d21eb1ad
...
...
@@ -5,10 +5,20 @@
'
use strict
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
createDecorator
as
createServiceDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
createDecorator
}
from
'
vs/base/common/decorators
'
;
export
const
ILogService
=
createDecorator
<
ILogService
>
(
'
logService
'
);
export
const
ILogService
=
createServiceDecorator
<
ILogService
>
(
'
logService
'
);
export
enum
LogLevel
{
TRACE
,
DEBUG
,
INFO
,
WARN
,
ERROR
,
CRITICAL
}
export
interface
ILogService
{
_serviceBrand
:
any
;
...
...
@@ -55,4 +65,33 @@ export class LegacyLogMainService implements ILogService {
critical
(
message
:
string
,
...
args
:
any
[]):
void
{
// console.log(`\x1b[90m[main ${new Date().toLocaleTimeString()}]\x1b[0m`, ...args);
}
}
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
{
return
createDecorator
((
fn
,
key
)
=>
{
return
function
(
this
:
any
,
...
args
:
any
[])
{
let
message
=
`
${
prefix
}
-
${
key
}
`
;
if
(
fn
)
{
message
=
fn
(
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
);
}
return
fn
.
apply
(
this
,
args
);
};
});
}
\ No newline at end of file
src/vs/platform/log/node/spdlogService.ts
浏览文件 @
d21eb1ad
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
,
setGlobalLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
export
class
SpdLogService
implements
ILogService
{
...
...
@@ -14,9 +14,14 @@ 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
{
...
...
src/vs/workbench/electron-browser/main.ts
浏览文件 @
d21eb1ad
...
...
@@ -73,7 +73,7 @@ function openWorkbench(configuration: IWindowConfiguration): TPromise<void> {
const
mainServices
=
createMainProcessServices
(
mainProcessClient
);
const
environmentService
=
new
EnvironmentService
(
configuration
,
configuration
.
execPath
);
const
logService
=
new
SpdLogService
(
'
renderer
'
,
environmentService
);
const
logService
=
new
SpdLogService
(
'
renderer
'
,
true
,
environmentService
);
logService
.
info
(
'
openWorkbench
'
,
JSON
.
stringify
(
configuration
,
null
,
2
));
// Since the configuration service is one of the core services that is used in so many places, we initialize it
...
...
src/vs/workbench/services/scm/common/scmService.ts
浏览文件 @
d21eb1ad
...
...
@@ -8,6 +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
'
;
class
SCMInput
implements
ISCMInput
{
...
...
@@ -78,6 +79,7 @@ export class SCMService implements ISCMService {
constructor
()
{
}
@
log
(
LogLevel
.
INFO
,
'
SCMService
'
)
registerSCMProvider
(
provider
:
ISCMProvider
):
ISCMRepository
{
if
(
this
.
_providerIds
.
has
(
provider
.
id
))
{
throw
new
Error
(
`SCM Provider
${
provider
.
id
}
already exists.`
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录