Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
637d0b2f
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
637d0b2f
编写于
12月 05, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
log - do not use colors on windows
上级
e9c830a5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
14 deletion
+41
-14
src/vs/code/electron-main/main.ts
src/vs/code/electron-main/main.ts
+3
-3
src/vs/platform/backup/test/electron-main/backupMainService.test.ts
...tform/backup/test/electron-main/backupMainService.test.ts
+2
-2
src/vs/platform/log/common/log.ts
src/vs/platform/log/common/log.ts
+34
-7
src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts
...rkspaces/test/electron-main/workspacesMainService.test.ts
+2
-2
未找到文件。
src/vs/code/electron-main/main.ts
浏览文件 @
637d0b2f
...
...
@@ -20,7 +20,7 @@ import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiati
import
{
InstantiationService
}
from
'
vs/platform/instantiation/common/instantiationService
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
ILogService
,
Legacy
LogMainService
,
MultiplexLogService
,
registerGlobalLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
,
Console
LogMainService
,
MultiplexLogService
,
registerGlobalLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
StateService
}
from
'
vs/platform/state/node/stateService
'
;
import
{
IStateService
}
from
'
vs/platform/state/common/state
'
;
import
{
IBackupMainService
}
from
'
vs/platform/backup/common/backup
'
;
...
...
@@ -49,8 +49,8 @@ function createServices(args: ParsedArgs): IInstantiationService {
const
environmentService
=
new
EnvironmentService
(
args
,
process
.
execPath
);
const
spdlogService
=
new
SpdLogService
(
'
main
'
,
environmentService
);
const
legacyLogService
=
new
Legacy
LogMainService
(
environmentService
);
const
logService
=
new
MultiplexLogService
([
legacy
LogService
,
spdlogService
]);
const
consoleLogService
=
new
Console
LogMainService
(
environmentService
);
const
logService
=
new
MultiplexLogService
([
console
LogService
,
spdlogService
]);
registerGlobalLogService
(
logService
);
process
.
once
(
'
exit
'
,
()
=>
logService
.
dispose
());
...
...
src/vs/platform/backup/test/electron-main/backupMainService.test.ts
浏览文件 @
637d0b2f
...
...
@@ -19,7 +19,7 @@ import { BackupMainService } from 'vs/platform/backup/electron-main/backupMainSe
import
{
IBackupWorkspacesFormat
}
from
'
vs/platform/backup/common/backup
'
;
import
{
HotExitConfiguration
}
from
'
vs/platform/files/common/files
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
Legacy
LogMainService
}
from
'
vs/platform/log/common/log
'
;
import
{
Console
LogMainService
}
from
'
vs/platform/log/common/log
'
;
import
{
IWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
createHash
}
from
'
crypto
'
;
import
{
getRandomTestPath
}
from
'
vs/workbench/test/workbenchTestServices
'
;
...
...
@@ -34,7 +34,7 @@ suite('BackupMainService', () => {
class
TestBackupMainService
extends
BackupMainService
{
constructor
(
backupHome
:
string
,
backupWorkspacesPath
:
string
,
configService
:
TestConfigurationService
)
{
super
(
environmentService
,
configService
,
new
Legacy
LogMainService
(
environmentService
));
super
(
environmentService
,
configService
,
new
Console
LogMainService
(
environmentService
));
this
.
backupHome
=
backupHome
;
this
.
workspacesJsonPath
=
backupWorkspacesPath
;
...
...
src/vs/platform/log/common/log.ts
浏览文件 @
637d0b2f
...
...
@@ -9,6 +9,7 @@ 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
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
export
const
ILogService
=
createServiceDecorator
<
ILogService
>
(
'
logService
'
);
...
...
@@ -34,13 +35,15 @@ export interface ILogService extends IDisposable {
critical
(
message
:
string
|
Error
,
...
args
:
any
[]):
void
;
}
export
class
Legacy
LogMainService
implements
ILogService
{
export
class
Console
LogMainService
implements
ILogService
{
_serviceBrand
:
any
;
private
level
:
LogLevel
=
LogLevel
.
Error
;
private
useColors
:
boolean
;
constructor
(
@
IEnvironmentService
environmentService
:
IEnvironmentService
)
{
this
.
setLevel
(
environmentService
.
logLevel
);
this
.
useColors
=
!
isWindows
;
}
setLevel
(
level
:
LogLevel
):
void
{
...
...
@@ -49,37 +52,61 @@ export class LegacyLogMainService implements ILogService {
trace
(
message
:
string
,
...
args
:
any
[]):
void
{
if
(
this
.
level
<=
LogLevel
.
Trace
)
{
console
.
log
(
`\x1b[90m[main
${
new
Date
().
toLocaleTimeString
()}
]\x1b[0m`
,
message
,
...
args
);
if
(
this
.
useColors
)
{
console
.
log
(
`\x1b[90m[main
${
new
Date
().
toLocaleTimeString
()}
]\x1b[0m`
,
message
,
...
args
);
}
else
{
console
.
log
(
`[main
${
new
Date
().
toLocaleTimeString
()}
]`
,
message
,
...
args
);
}
}
}
debug
(
message
:
string
,
...
args
:
any
[]):
void
{
if
(
this
.
level
<=
LogLevel
.
Debug
)
{
console
.
log
(
`\x1b[90m[main
${
new
Date
().
toLocaleTimeString
()}
]\x1b[0m`
,
message
,
...
args
);
if
(
this
.
useColors
)
{
console
.
log
(
`\x1b[90m[main
${
new
Date
().
toLocaleTimeString
()}
]\x1b[0m`
,
message
,
...
args
);
}
else
{
console
.
log
(
`[main
${
new
Date
().
toLocaleTimeString
()}
]`
,
message
,
...
args
);
}
}
}
info
(
message
:
string
,
...
args
:
any
[]):
void
{
if
(
this
.
level
<=
LogLevel
.
Info
)
{
console
.
log
(
`\x1b[90m[main
${
new
Date
().
toLocaleTimeString
()}
]\x1b[0m`
,
message
,
...
args
);
if
(
this
.
useColors
)
{
console
.
log
(
`\x1b[90m[main
${
new
Date
().
toLocaleTimeString
()}
]\x1b[0m`
,
message
,
...
args
);
}
else
{
console
.
log
(
`[main
${
new
Date
().
toLocaleTimeString
()}
]`
,
message
,
...
args
);
}
}
}
warn
(
message
:
string
|
Error
,
...
args
:
any
[]):
void
{
if
(
this
.
level
<=
LogLevel
.
Warning
)
{
console
.
warn
(
`\x1b[93m[main
${
new
Date
().
toLocaleTimeString
()}
]\x1b[0m`
,
message
,
...
args
);
if
(
this
.
useColors
)
{
console
.
warn
(
`\x1b[93m[main
${
new
Date
().
toLocaleTimeString
()}
]\x1b[0m`
,
message
,
...
args
);
}
else
{
console
.
warn
(
`[main
${
new
Date
().
toLocaleTimeString
()}
]`
,
message
,
...
args
);
}
}
}
error
(
message
:
string
,
...
args
:
any
[]):
void
{
if
(
this
.
level
<=
LogLevel
.
Error
)
{
console
.
error
(
`\x1b[91m[main
${
new
Date
().
toLocaleTimeString
()}
]\x1b[0m`
,
message
,
...
args
);
if
(
this
.
useColors
)
{
console
.
error
(
`\x1b[91m[main
${
new
Date
().
toLocaleTimeString
()}
]\x1b[0m`
,
message
,
...
args
);
}
else
{
console
.
error
(
`[main
${
new
Date
().
toLocaleTimeString
()}
]`
,
message
,
...
args
);
}
}
}
critical
(
message
:
string
,
...
args
:
any
[]):
void
{
if
(
this
.
level
<=
LogLevel
.
Critical
)
{
console
.
error
(
`\x1b[90m[main
${
new
Date
().
toLocaleTimeString
()}
]\x1b[0m`
,
message
,
...
args
);
if
(
this
.
useColors
)
{
console
.
error
(
`\x1b[90m[main
${
new
Date
().
toLocaleTimeString
()}
]\x1b[0m`
,
message
,
...
args
);
}
else
{
console
.
error
(
`[main
${
new
Date
().
toLocaleTimeString
()}
]`
,
message
,
...
args
);
}
}
}
...
...
src/vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts
浏览文件 @
637d0b2f
...
...
@@ -15,7 +15,7 @@ import { EnvironmentService } from 'vs/platform/environment/node/environmentServ
import
{
parseArgs
}
from
'
vs/platform/environment/node/argv
'
;
import
{
WorkspacesMainService
,
IStoredWorkspace
}
from
'
vs/platform/workspaces/electron-main/workspacesMainService
'
;
import
{
WORKSPACE_EXTENSION
,
IWorkspaceSavedEvent
,
IWorkspaceIdentifier
,
IRawFileWorkspaceFolder
,
IWorkspaceFolderCreationData
,
IRawUriWorkspaceFolder
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
Legacy
LogMainService
}
from
'
vs/platform/log/common/log
'
;
import
{
Console
LogMainService
}
from
'
vs/platform/log/common/log
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
getRandomTestPath
}
from
'
vs/workbench/test/workbenchTestServices
'
;
...
...
@@ -48,7 +48,7 @@ suite('WorkspacesMainService', () => {
}
const
environmentService
=
new
TestEnvironmentService
(
parseArgs
(
process
.
argv
),
process
.
execPath
);
const
logService
=
new
Legacy
LogMainService
(
environmentService
);
const
logService
=
new
Console
LogMainService
(
environmentService
);
let
service
:
TestWorkspacesMainService
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录