@codingame/monaco-vscode-log-service-override 25.1.2 → 26.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/override/vs/workbench/browser/web.main.js +1 -1
- package/package.json +3 -3
- package/vscode/src/vs/platform/log/common/fileLog.js +21 -21
- package/vscode/src/vs/workbench/contrib/logs/common/logs.contribution.js +48 -27
- package/vscode/src/vs/workbench/contrib/logs/common/logsActions.js +113 -47
- package/vscode/src/vs/workbench/services/log/common/defaultLogLevels.js +27 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-log-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - log service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "
|
|
19
|
-
"@codingame/monaco-vscode-environment-service-override": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "26.0.1",
|
|
19
|
+
"@codingame/monaco-vscode-environment-service-override": "26.0.1"
|
|
20
20
|
},
|
|
21
21
|
"main": "index.js",
|
|
22
22
|
"module": "index.js",
|
|
@@ -16,7 +16,7 @@ let FileLogger = class FileLogger extends AbstractMessageLogger {
|
|
|
16
16
|
this.donotUseFormatters = donotUseFormatters;
|
|
17
17
|
this.fileService = fileService;
|
|
18
18
|
this.backupIndex = 1;
|
|
19
|
-
this.buffer =
|
|
19
|
+
this.buffer = "";
|
|
20
20
|
this.setLevel(level);
|
|
21
21
|
this.flushDelayer = ( new ThrottledDelayer(100 ));
|
|
22
22
|
this.initializePromise = this.initialize();
|
|
@@ -29,19 +29,18 @@ let FileLogger = class FileLogger extends AbstractMessageLogger {
|
|
|
29
29
|
let content = await this.loadContent();
|
|
30
30
|
if (content.length > MAX_FILE_SIZE) {
|
|
31
31
|
await this.fileService.writeFile(this.getBackupResource(), VSBuffer.fromString(content));
|
|
32
|
-
content =
|
|
32
|
+
content = "";
|
|
33
33
|
}
|
|
34
34
|
if (this.buffer) {
|
|
35
35
|
content += this.buffer;
|
|
36
|
-
this.buffer =
|
|
36
|
+
this.buffer = "";
|
|
37
37
|
await this.fileService.writeFile(this.resource, VSBuffer.fromString(content));
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
async initialize() {
|
|
41
41
|
try {
|
|
42
42
|
await this.fileService.createFile(this.resource);
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
43
|
+
} catch (error) {
|
|
45
44
|
if (error.fileOperationResult !== FileOperationResult.FILE_MODIFIED_SINCE) {
|
|
46
45
|
throw error;
|
|
47
46
|
}
|
|
@@ -50,15 +49,14 @@ let FileLogger = class FileLogger extends AbstractMessageLogger {
|
|
|
50
49
|
log(level, message) {
|
|
51
50
|
if (this.donotUseFormatters) {
|
|
52
51
|
this.buffer += message;
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
52
|
+
} else {
|
|
55
53
|
this.buffer += `${this.getCurrentTimestamp()} [${this.stringifyLogLevel(level)}] ${message}\n`;
|
|
56
54
|
}
|
|
57
55
|
this.flushDelayer.trigger(() => this.flush());
|
|
58
56
|
}
|
|
59
57
|
getCurrentTimestamp() {
|
|
60
|
-
const toTwoDigits =
|
|
61
|
-
const toThreeDigits =
|
|
58
|
+
const toTwoDigits = v => v < 10 ? `0${v}` : v;
|
|
59
|
+
const toThreeDigits = v => v < 10 ? `00${v}` : v < 100 ? `0${v}` : v;
|
|
62
60
|
const currentTime = ( new Date());
|
|
63
61
|
return `${currentTime.getFullYear()}-${toTwoDigits(currentTime.getMonth() + 1)}-${toTwoDigits(currentTime.getDate())} ${toTwoDigits(currentTime.getHours())}:${toTwoDigits(currentTime.getMinutes())}:${toTwoDigits(currentTime.getSeconds())}.${toThreeDigits(currentTime.getMilliseconds())}`;
|
|
64
62
|
}
|
|
@@ -70,25 +68,27 @@ let FileLogger = class FileLogger extends AbstractMessageLogger {
|
|
|
70
68
|
try {
|
|
71
69
|
const content = await this.fileService.readFile(this.resource);
|
|
72
70
|
return ( content.value.toString());
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return '';
|
|
71
|
+
} catch (e) {
|
|
72
|
+
return "";
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
stringifyLogLevel(level) {
|
|
79
76
|
switch (level) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
case LogLevel.Debug:
|
|
78
|
+
return "debug";
|
|
79
|
+
case LogLevel.Error:
|
|
80
|
+
return "error";
|
|
81
|
+
case LogLevel.Info:
|
|
82
|
+
return "info";
|
|
83
|
+
case LogLevel.Trace:
|
|
84
|
+
return "trace";
|
|
85
|
+
case LogLevel.Warning:
|
|
86
|
+
return "warning";
|
|
85
87
|
}
|
|
86
|
-
return
|
|
88
|
+
return "";
|
|
87
89
|
}
|
|
88
90
|
};
|
|
89
|
-
FileLogger = ( __decorate([
|
|
90
|
-
( __param(3, IFileService))
|
|
91
|
-
], FileLogger));
|
|
91
|
+
FileLogger = ( __decorate([( __param(3, IFileService))], FileLogger));
|
|
92
92
|
class FileLoggerService extends AbstractLoggerService {
|
|
93
93
|
constructor(logLevel, logsHome, fileService) {
|
|
94
94
|
super(logLevel, logsHome);
|
|
@@ -39,9 +39,9 @@ registerAction2(class extends Action2 {
|
|
|
39
39
|
registerAction2(class extends Action2 {
|
|
40
40
|
constructor() {
|
|
41
41
|
super({
|
|
42
|
-
id:
|
|
43
|
-
title: ( localize2(
|
|
44
|
-
category: Categories.Developer
|
|
42
|
+
id: "workbench.action.setDefaultLogLevel",
|
|
43
|
+
title: ( localize2(8893, "Set Default Log Level")),
|
|
44
|
+
category: Categories.Developer
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
run(servicesAccessor, logLevel, extensionId) {
|
|
@@ -64,7 +64,12 @@ let LogOutputChannels = class LogOutputChannels extends Disposable {
|
|
|
64
64
|
}
|
|
65
65
|
}));
|
|
66
66
|
this.onDidAddLoggers(loggerService.getRegisteredLoggers());
|
|
67
|
-
this._register(loggerService.onDidChangeLoggers((
|
|
67
|
+
this._register(loggerService.onDidChangeLoggers((
|
|
68
|
+
{
|
|
69
|
+
added,
|
|
70
|
+
removed
|
|
71
|
+
}
|
|
72
|
+
) => {
|
|
68
73
|
this.onDidAddLoggers(added);
|
|
69
74
|
this.onDidRemoveLoggers(removed);
|
|
70
75
|
}));
|
|
@@ -73,14 +78,15 @@ let LogOutputChannels = class LogOutputChannels extends Disposable {
|
|
|
73
78
|
if (logger) {
|
|
74
79
|
if (visibility) {
|
|
75
80
|
this.registerLogChannel(logger);
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
81
|
+
} else {
|
|
78
82
|
this.deregisterLogChannel(logger);
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
85
|
}));
|
|
82
86
|
this.registerShowWindowLogAction();
|
|
83
|
-
this._register(
|
|
87
|
+
this._register(
|
|
88
|
+
Event.filter(contextKeyService.onDidChangeContext, e => e.affectsSome(this.contextKeys))(() => this.onDidChangeContext())
|
|
89
|
+
);
|
|
84
90
|
}
|
|
85
91
|
onDidAddLoggers(loggers) {
|
|
86
92
|
for (const logger of loggers) {
|
|
@@ -106,8 +112,7 @@ let LogOutputChannels = class LogOutputChannels extends Disposable {
|
|
|
106
112
|
if (logger.when) {
|
|
107
113
|
if (this.contextKeyService.contextMatchesRules(ContextKeyExpr.deserialize(logger.when))) {
|
|
108
114
|
this.registerLogChannel(logger);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
115
|
+
} else {
|
|
111
116
|
this.deregisterLogChannel(logger);
|
|
112
117
|
}
|
|
113
118
|
}
|
|
@@ -142,31 +147,51 @@ let LogOutputChannels = class LogOutputChannels extends Disposable {
|
|
|
142
147
|
}
|
|
143
148
|
const hasToAppendRemote = existingChannel && logger.resource.scheme === Schemas.vscodeRemote;
|
|
144
149
|
const id = hasToAppendRemote ? `${logger.id}.remote` : logger.id;
|
|
145
|
-
const label = hasToAppendRemote ? ( localize(
|
|
146
|
-
this.outputChannelRegistry.registerChannel({
|
|
150
|
+
const label = hasToAppendRemote ? ( localize(8894, "{0} (Remote)", logger.name ?? logger.id)) : logger.name ?? logger.id;
|
|
151
|
+
this.outputChannelRegistry.registerChannel({
|
|
152
|
+
id,
|
|
153
|
+
label,
|
|
154
|
+
source: {
|
|
155
|
+
resource: logger.resource
|
|
156
|
+
},
|
|
157
|
+
log: true,
|
|
158
|
+
extensionId: logger.extensionId
|
|
159
|
+
});
|
|
147
160
|
}
|
|
148
161
|
registerCompoundLogChannel(id, name, logger) {
|
|
149
162
|
const channel = this.outputChannelRegistry.getChannel(id);
|
|
150
|
-
const source = {
|
|
163
|
+
const source = {
|
|
164
|
+
resource: logger.resource,
|
|
165
|
+
name: logger.name ?? logger.id
|
|
166
|
+
};
|
|
151
167
|
if (channel) {
|
|
152
|
-
if (isMultiSourceOutputChannelDescriptor(channel) && !( channel.source.some(
|
|
153
|
-
|
|
154
|
-
|
|
168
|
+
if (isMultiSourceOutputChannelDescriptor(channel) && !( channel.source.some((
|
|
169
|
+
{
|
|
170
|
+
resource
|
|
171
|
+
}
|
|
172
|
+
) => this.uriIdentityService.extUri.isEqual(resource, logger.resource)))) {
|
|
155
173
|
this.outputChannelRegistry.updateChannelSources(id, [...channel.source, source]);
|
|
156
174
|
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
175
|
+
} else {
|
|
176
|
+
this.outputChannelRegistry.registerChannel({
|
|
177
|
+
id,
|
|
178
|
+
label: name,
|
|
179
|
+
log: true,
|
|
180
|
+
source: [source]
|
|
181
|
+
});
|
|
160
182
|
}
|
|
161
183
|
}
|
|
162
184
|
deregisterLogChannel(logger) {
|
|
163
185
|
if (logger.group) {
|
|
164
186
|
const channel = this.outputChannelRegistry.getChannel(logger.group.id);
|
|
165
187
|
if (channel && isMultiSourceOutputChannelDescriptor(channel)) {
|
|
166
|
-
this.outputChannelRegistry.updateChannelSources(logger.group.id, channel.source.filter((
|
|
188
|
+
this.outputChannelRegistry.updateChannelSources(logger.group.id, channel.source.filter((
|
|
189
|
+
{
|
|
190
|
+
resource
|
|
191
|
+
}
|
|
192
|
+
) => !this.uriIdentityService.extUri.isEqual(resource, logger.resource)));
|
|
167
193
|
}
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
194
|
+
} else {
|
|
170
195
|
this.outputChannelRegistry.removeChannel(logger.id);
|
|
171
196
|
}
|
|
172
197
|
}
|
|
@@ -175,7 +200,7 @@ let LogOutputChannels = class LogOutputChannels extends Disposable {
|
|
|
175
200
|
constructor() {
|
|
176
201
|
super({
|
|
177
202
|
id: showWindowLogActionId,
|
|
178
|
-
title: ( localize2(
|
|
203
|
+
title: ( localize2(8895, "Show Window Log")),
|
|
179
204
|
category: Categories.Developer,
|
|
180
205
|
f1: true
|
|
181
206
|
});
|
|
@@ -187,9 +212,5 @@ let LogOutputChannels = class LogOutputChannels extends Disposable {
|
|
|
187
212
|
}));
|
|
188
213
|
}
|
|
189
214
|
};
|
|
190
|
-
LogOutputChannels = ( __decorate([
|
|
191
|
-
( __param(0, ILoggerService)),
|
|
192
|
-
( __param(1, IContextKeyService)),
|
|
193
|
-
( __param(2, IUriIdentityService))
|
|
194
|
-
], LogOutputChannels));
|
|
215
|
+
LogOutputChannels = ( __decorate([( __param(0, ILoggerService)), ( __param(1, IContextKeyService)), ( __param(2, IUriIdentityService))], LogOutputChannels));
|
|
195
216
|
( Registry.as(Extensions$1.Workbench)).registerWorkbenchContribution(LogOutputChannels, LifecyclePhase.Restored);
|
|
@@ -16,9 +16,20 @@ import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/com
|
|
|
16
16
|
import { IDefaultLogLevelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/log/common/defaultLogLevels.service';
|
|
17
17
|
|
|
18
18
|
let SetLogLevelAction = class SetLogLevelAction extends Action {
|
|
19
|
-
static {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
static {
|
|
20
|
+
this.ID = "workbench.action.setLogLevel";
|
|
21
|
+
}
|
|
22
|
+
static {
|
|
23
|
+
this.TITLE = ( localize2(8896, "Set Log Level..."));
|
|
24
|
+
}
|
|
25
|
+
constructor(
|
|
26
|
+
id,
|
|
27
|
+
label,
|
|
28
|
+
quickInputService,
|
|
29
|
+
loggerService,
|
|
30
|
+
outputService,
|
|
31
|
+
defaultLogLevelsService
|
|
32
|
+
) {
|
|
22
33
|
super(id, label);
|
|
23
34
|
this.quickInputService = quickInputService;
|
|
24
35
|
this.loggerService = loggerService;
|
|
@@ -30,8 +41,7 @@ let SetLogLevelAction = class SetLogLevelAction extends Action {
|
|
|
30
41
|
if (logLevelOrChannel !== null) {
|
|
31
42
|
if (isLogLevel(logLevelOrChannel)) {
|
|
32
43
|
this.loggerService.setLogLevel(logLevelOrChannel);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
44
|
+
} else {
|
|
35
45
|
await this.setLogLevelForChannel(logLevelOrChannel);
|
|
36
46
|
}
|
|
37
47
|
}
|
|
@@ -48,7 +58,10 @@ let SetLogLevelAction = class SetLogLevelAction extends Action {
|
|
|
48
58
|
if (!sources.length) {
|
|
49
59
|
continue;
|
|
50
60
|
}
|
|
51
|
-
const channelLogLevel = sources.reduce(
|
|
61
|
+
const channelLogLevel = sources.reduce(
|
|
62
|
+
(prev, curr) => Math.min(prev, this.loggerService.getLogLevel(curr.resource) ?? logLevel),
|
|
63
|
+
logLevel
|
|
64
|
+
);
|
|
52
65
|
const item = {
|
|
53
66
|
id: channel.id,
|
|
54
67
|
label: channel.label,
|
|
@@ -57,24 +70,36 @@ let SetLogLevelAction = class SetLogLevelAction extends Action {
|
|
|
57
70
|
};
|
|
58
71
|
if (channel.extensionId) {
|
|
59
72
|
extensionLogs.push(item);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
73
|
+
} else {
|
|
62
74
|
logs.push(item);
|
|
63
75
|
}
|
|
64
76
|
}
|
|
65
77
|
const entries = [];
|
|
66
|
-
entries.push({
|
|
67
|
-
|
|
78
|
+
entries.push({
|
|
79
|
+
type: "separator",
|
|
80
|
+
label: ( localize(8897, "All"))
|
|
81
|
+
});
|
|
82
|
+
entries.push(
|
|
83
|
+
...this.getLogLevelEntries(defaultLogLevels.default, this.loggerService.getLogLevel(), true)
|
|
84
|
+
);
|
|
68
85
|
if (extensionLogs.length) {
|
|
69
|
-
entries.push({
|
|
86
|
+
entries.push({
|
|
87
|
+
type: "separator",
|
|
88
|
+
label: ( localize(8898, "Extension Logs"))
|
|
89
|
+
});
|
|
70
90
|
entries.push(...extensionLogs.sort((a, b) => a.label.localeCompare(b.label)));
|
|
71
91
|
}
|
|
72
|
-
entries.push({
|
|
92
|
+
entries.push({
|
|
93
|
+
type: "separator",
|
|
94
|
+
label: ( localize(8899, "Logs"))
|
|
95
|
+
});
|
|
73
96
|
entries.push(...logs.sort((a, b) => a.label.localeCompare(b.label)));
|
|
74
97
|
return (new Promise((resolve, reject) => {
|
|
75
98
|
const disposables = ( new DisposableStore());
|
|
76
|
-
const quickPick = disposables.add(this.quickInputService.createQuickPick({
|
|
77
|
-
|
|
99
|
+
const quickPick = disposables.add(this.quickInputService.createQuickPick({
|
|
100
|
+
useSeparators: true
|
|
101
|
+
}));
|
|
102
|
+
quickPick.placeholder = ( localize(8900, "Set Log Level"));
|
|
78
103
|
quickPick.items = entries;
|
|
79
104
|
let selectedItem;
|
|
80
105
|
disposables.add(quickPick.onDidTriggerItemButton(e => {
|
|
@@ -96,13 +121,17 @@ let SetLogLevelAction = class SetLogLevelAction extends Action {
|
|
|
96
121
|
async setLogLevelForChannel(logChannel) {
|
|
97
122
|
const defaultLogLevels = this.defaultLogLevelsService.defaultLogLevels;
|
|
98
123
|
const defaultLogLevel = defaultLogLevels.extensions.find(e => e[0] === logChannel.channel.extensionId?.toLowerCase())?.[1] ?? defaultLogLevels.default;
|
|
99
|
-
const entries = this.getLogLevelEntries(
|
|
124
|
+
const entries = this.getLogLevelEntries(
|
|
125
|
+
defaultLogLevel,
|
|
126
|
+
this.outputService.getLogLevel(logChannel.channel) ?? defaultLogLevel,
|
|
127
|
+
!!logChannel.channel.extensionId
|
|
128
|
+
);
|
|
100
129
|
return (new Promise((resolve, reject) => {
|
|
101
130
|
const disposables = ( new DisposableStore());
|
|
102
131
|
const quickPick = disposables.add(this.quickInputService.createQuickPick());
|
|
103
|
-
quickPick.placeholder = logChannel ? ( localize(
|
|
132
|
+
quickPick.placeholder = logChannel ? ( localize(8901, " {0}: Select log level", logChannel?.label)) : ( localize(8902, "Select log level"));
|
|
104
133
|
quickPick.items = entries;
|
|
105
|
-
quickPick.activeItems = entries.filter(
|
|
134
|
+
quickPick.activeItems = entries.filter(entry => entry.level === this.loggerService.getLogLevel());
|
|
106
135
|
let selectedItem;
|
|
107
136
|
disposables.add(quickPick.onDidTriggerItemButton(e => {
|
|
108
137
|
quickPick.hide();
|
|
@@ -123,34 +152,66 @@ let SetLogLevelAction = class SetLogLevelAction extends Action {
|
|
|
123
152
|
}));
|
|
124
153
|
}
|
|
125
154
|
getLogLevelEntries(defaultLogLevel, currentLogLevel, canSetDefaultLogLevel) {
|
|
126
|
-
const button = canSetDefaultLogLevel ? {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
155
|
+
const button = canSetDefaultLogLevel ? {
|
|
156
|
+
iconClass: ThemeIcon.asClassName(Codicon.checkAll),
|
|
157
|
+
tooltip: ( localize(8903, "Set as Default Log Level"))
|
|
158
|
+
} : undefined;
|
|
159
|
+
return [{
|
|
160
|
+
label: this.getLabel(LogLevel.Trace, currentLogLevel),
|
|
161
|
+
level: LogLevel.Trace,
|
|
162
|
+
description: this.getDescription(LogLevel.Trace, defaultLogLevel),
|
|
163
|
+
buttons: button && defaultLogLevel !== LogLevel.Trace ? [button] : undefined
|
|
164
|
+
}, {
|
|
165
|
+
label: this.getLabel(LogLevel.Debug, currentLogLevel),
|
|
166
|
+
level: LogLevel.Debug,
|
|
167
|
+
description: this.getDescription(LogLevel.Debug, defaultLogLevel),
|
|
168
|
+
buttons: button && defaultLogLevel !== LogLevel.Debug ? [button] : undefined
|
|
169
|
+
}, {
|
|
170
|
+
label: this.getLabel(LogLevel.Info, currentLogLevel),
|
|
171
|
+
level: LogLevel.Info,
|
|
172
|
+
description: this.getDescription(LogLevel.Info, defaultLogLevel),
|
|
173
|
+
buttons: button && defaultLogLevel !== LogLevel.Info ? [button] : undefined
|
|
174
|
+
}, {
|
|
175
|
+
label: this.getLabel(LogLevel.Warning, currentLogLevel),
|
|
176
|
+
level: LogLevel.Warning,
|
|
177
|
+
description: this.getDescription(LogLevel.Warning, defaultLogLevel),
|
|
178
|
+
buttons: button && defaultLogLevel !== LogLevel.Warning ? [button] : undefined
|
|
179
|
+
}, {
|
|
180
|
+
label: this.getLabel(LogLevel.Error, currentLogLevel),
|
|
181
|
+
level: LogLevel.Error,
|
|
182
|
+
description: this.getDescription(LogLevel.Error, defaultLogLevel),
|
|
183
|
+
buttons: button && defaultLogLevel !== LogLevel.Error ? [button] : undefined
|
|
184
|
+
}, {
|
|
185
|
+
label: this.getLabel(LogLevel.Off, currentLogLevel),
|
|
186
|
+
level: LogLevel.Off,
|
|
187
|
+
description: this.getDescription(LogLevel.Off, defaultLogLevel),
|
|
188
|
+
buttons: button && defaultLogLevel !== LogLevel.Off ? [button] : undefined
|
|
189
|
+
}];
|
|
135
190
|
}
|
|
136
191
|
getLabel(level, current) {
|
|
137
192
|
const label = LogLevelToLocalizedString(level).value;
|
|
138
193
|
return level === current ? `$(check) ${label}` : label;
|
|
139
194
|
}
|
|
140
195
|
getDescription(level, defaultLogLevel) {
|
|
141
|
-
return defaultLogLevel === level ? ( localize(
|
|
196
|
+
return defaultLogLevel === level ? ( localize(8904, "Default")) : undefined;
|
|
142
197
|
}
|
|
143
198
|
};
|
|
144
|
-
SetLogLevelAction = ( __decorate([
|
|
145
|
-
( __param(2, IQuickInputService)),
|
|
146
|
-
( __param(3, ILoggerService)),
|
|
147
|
-
( __param(4, IOutputService)),
|
|
148
|
-
( __param(5, IDefaultLogLevelsService))
|
|
149
|
-
], SetLogLevelAction));
|
|
199
|
+
SetLogLevelAction = ( __decorate([( __param(2, IQuickInputService)), ( __param(3, ILoggerService)), ( __param(4, IOutputService)), ( __param(5, IDefaultLogLevelsService))], SetLogLevelAction));
|
|
150
200
|
(class OpenWindowSessionLogFileAction extends Action {
|
|
151
|
-
static {
|
|
152
|
-
|
|
153
|
-
|
|
201
|
+
static {
|
|
202
|
+
this.ID = "workbench.action.openSessionLogFile";
|
|
203
|
+
}
|
|
204
|
+
static {
|
|
205
|
+
this.TITLE = ( localize2(8905, "Open Window Log File (Session)..."));
|
|
206
|
+
}
|
|
207
|
+
constructor(
|
|
208
|
+
id,
|
|
209
|
+
label,
|
|
210
|
+
environmentService,
|
|
211
|
+
fileService,
|
|
212
|
+
quickInputService,
|
|
213
|
+
editorService
|
|
214
|
+
) {
|
|
154
215
|
super(id, label);
|
|
155
216
|
this.environmentService = environmentService;
|
|
156
217
|
this.fileService = fileService;
|
|
@@ -161,34 +222,39 @@ SetLogLevelAction = ( __decorate([
|
|
|
161
222
|
const sessionResult = await this.quickInputService.pick(this.getSessions().then(sessions => ( sessions.map((s, index) => ({
|
|
162
223
|
id: ( s.toString()),
|
|
163
224
|
label: basename(s),
|
|
164
|
-
description: index === 0 ? ( localize(
|
|
225
|
+
description: index === 0 ? ( localize(8906, "Current")) : undefined
|
|
165
226
|
})))), {
|
|
166
227
|
canPickMany: false,
|
|
167
|
-
placeHolder: ( localize(
|
|
228
|
+
placeHolder: ( localize(8907, "Select Session"))
|
|
168
229
|
});
|
|
169
230
|
if (sessionResult) {
|
|
170
|
-
const logFileResult = await this.quickInputService.pick(this.getLogFiles(( URI.parse(sessionResult.id))).then(logFiles => ( logFiles.map(
|
|
231
|
+
const logFileResult = await this.quickInputService.pick(this.getLogFiles(( URI.parse(sessionResult.id))).then(logFiles => ( logFiles.map(s => ({
|
|
171
232
|
id: ( s.toString()),
|
|
172
233
|
label: basename(s)
|
|
173
234
|
})))), {
|
|
174
235
|
canPickMany: false,
|
|
175
|
-
placeHolder: ( localize(
|
|
236
|
+
placeHolder: ( localize(8908, "Select Log file"))
|
|
176
237
|
});
|
|
177
238
|
if (logFileResult) {
|
|
178
|
-
return this.editorService.openEditor({
|
|
239
|
+
return this.editorService.openEditor({
|
|
240
|
+
resource: ( URI.parse(logFileResult.id)),
|
|
241
|
+
options: {
|
|
242
|
+
pinned: true
|
|
243
|
+
}
|
|
244
|
+
}).then(() => undefined);
|
|
179
245
|
}
|
|
180
246
|
}
|
|
181
247
|
}
|
|
182
248
|
async getSessions() {
|
|
183
|
-
const logsPath = this.environmentService.logsHome.with({
|
|
249
|
+
const logsPath = this.environmentService.logsHome.with({
|
|
250
|
+
scheme: this.environmentService.logFile.scheme
|
|
251
|
+
});
|
|
184
252
|
const result = [logsPath];
|
|
185
253
|
const stat = await this.fileService.resolve(dirname(logsPath));
|
|
186
254
|
if (stat.children) {
|
|
187
|
-
result.push(...( stat.children
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
.reverse()
|
|
191
|
-
.map(d => d.resource)));
|
|
255
|
+
result.push(...( stat.children.filter(
|
|
256
|
+
stat => !isEqual(stat.resource, logsPath) && stat.isDirectory && /^\d{8}T\d{6}$/.test(stat.name)
|
|
257
|
+
).sort().reverse().map(d => d.resource)));
|
|
192
258
|
}
|
|
193
259
|
return result;
|
|
194
260
|
}
|
|
@@ -16,7 +16,13 @@ import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objec
|
|
|
16
16
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
17
17
|
|
|
18
18
|
let DefaultLogLevelsService = class DefaultLogLevelsService extends Disposable {
|
|
19
|
-
constructor(
|
|
19
|
+
constructor(
|
|
20
|
+
environmentService,
|
|
21
|
+
fileService,
|
|
22
|
+
jsonEditingService,
|
|
23
|
+
logService,
|
|
24
|
+
loggerService
|
|
25
|
+
) {
|
|
20
26
|
super();
|
|
21
27
|
this.environmentService = environmentService;
|
|
22
28
|
this.fileService = fileService;
|
|
@@ -56,8 +62,7 @@ let DefaultLogLevelsService = class DefaultLogLevelsService extends Disposable {
|
|
|
56
62
|
if (extensionId) {
|
|
57
63
|
extensionId = extensionId.toLowerCase();
|
|
58
64
|
return this._getDefaultLogLevel(this._defaultLogLevels, extensionId);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
65
|
+
} else {
|
|
61
66
|
return this._getDefaultLogLevel(this._defaultLogLevels);
|
|
62
67
|
}
|
|
63
68
|
}
|
|
@@ -70,19 +75,21 @@ let DefaultLogLevelsService = class DefaultLogLevelsService extends Disposable {
|
|
|
70
75
|
const extension = defaultLogLevelsFromArgv.extensions.find(([extension]) => extension === extensionId);
|
|
71
76
|
if (extension) {
|
|
72
77
|
extension[1] = defaultLogLevel;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
78
|
+
} else {
|
|
75
79
|
defaultLogLevelsFromArgv.extensions.push([extensionId, defaultLogLevel]);
|
|
76
80
|
}
|
|
77
81
|
await this._writeLogLevelsToArgv(defaultLogLevelsFromArgv);
|
|
78
|
-
const extensionLoggers = [...this.loggerService.getRegisteredLoggers()].filter(
|
|
79
|
-
|
|
82
|
+
const extensionLoggers = [...this.loggerService.getRegisteredLoggers()].filter(
|
|
83
|
+
logger => logger.extensionId && logger.extensionId.toLowerCase() === extensionId
|
|
84
|
+
);
|
|
85
|
+
for (const {
|
|
86
|
+
resource
|
|
87
|
+
} of extensionLoggers) {
|
|
80
88
|
if (this.loggerService.getLogLevel(resource) === currentDefaultLogLevel) {
|
|
81
89
|
this.loggerService.setLogLevel(resource, defaultLogLevel);
|
|
82
90
|
}
|
|
83
91
|
}
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
92
|
+
} else {
|
|
86
93
|
const currentLogLevel = this._getDefaultLogLevel(defaultLogLevelsFromArgv);
|
|
87
94
|
defaultLogLevelsFromArgv.default = defaultLogLevel;
|
|
88
95
|
await this._writeLogLevelsToArgv(defaultLogLevelsFromArgv);
|
|
@@ -109,10 +116,15 @@ let DefaultLogLevelsService = class DefaultLogLevelsService extends Disposable {
|
|
|
109
116
|
for (const [extension, logLevel] of logLevels.extensions ?? []) {
|
|
110
117
|
logLevelsValue.push(`${extension}=${LogLevelToString(logLevel)}`);
|
|
111
118
|
}
|
|
112
|
-
await this.jsonEditingService.write(this.environmentService.argvResource, [{
|
|
119
|
+
await this.jsonEditingService.write(this.environmentService.argvResource, [{
|
|
120
|
+
path: ["log-level"],
|
|
121
|
+
value: logLevelsValue.length ? logLevelsValue : undefined
|
|
122
|
+
}], true);
|
|
113
123
|
}
|
|
114
124
|
async _parseLogLevelsFromArgv() {
|
|
115
|
-
const result = {
|
|
125
|
+
const result = {
|
|
126
|
+
extensions: []
|
|
127
|
+
};
|
|
116
128
|
const logLevels = await this._readLogLevelsFromArgv();
|
|
117
129
|
for (const extensionLogLevel of logLevels) {
|
|
118
130
|
const matches = EXTENSION_IDENTIFIER_WITH_LOG_REGEX.exec(extensionLogLevel);
|
|
@@ -121,8 +133,7 @@ let DefaultLogLevelsService = class DefaultLogLevelsService extends Disposable {
|
|
|
121
133
|
if (!isUndefined(logLevel)) {
|
|
122
134
|
result.extensions?.push([matches[1].toLowerCase(), logLevel]);
|
|
123
135
|
}
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
136
|
+
} else {
|
|
126
137
|
const logLevel = parseLogLevel(extensionLogLevel);
|
|
127
138
|
if (!isUndefined(logLevel)) {
|
|
128
139
|
result.default = logLevel;
|
|
@@ -135,9 +146,8 @@ let DefaultLogLevelsService = class DefaultLogLevelsService extends Disposable {
|
|
|
135
146
|
try {
|
|
136
147
|
const content = await this.fileService.readFile(this.environmentService.argvResource);
|
|
137
148
|
const argv = parse(( content.value.toString()));
|
|
138
|
-
return isString(argv[
|
|
139
|
-
}
|
|
140
|
-
catch (error) {
|
|
149
|
+
return isString(argv["log-level"]) ? [argv["log-level"]] : Array.isArray(argv["log-level"]) ? argv["log-level"] : [];
|
|
150
|
+
} catch (error) {
|
|
141
151
|
if (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {
|
|
142
152
|
this.logService.error(error);
|
|
143
153
|
}
|
|
@@ -158,12 +168,6 @@ let DefaultLogLevelsService = class DefaultLogLevelsService extends Disposable {
|
|
|
158
168
|
return result;
|
|
159
169
|
}
|
|
160
170
|
};
|
|
161
|
-
DefaultLogLevelsService = ( __decorate([
|
|
162
|
-
( __param(0, IWorkbenchEnvironmentService)),
|
|
163
|
-
( __param(1, IFileService)),
|
|
164
|
-
( __param(2, IJSONEditingService)),
|
|
165
|
-
( __param(3, ILogService)),
|
|
166
|
-
( __param(4, ILoggerService))
|
|
167
|
-
], DefaultLogLevelsService));
|
|
171
|
+
DefaultLogLevelsService = ( __decorate([( __param(0, IWorkbenchEnvironmentService)), ( __param(1, IFileService)), ( __param(2, IJSONEditingService)), ( __param(3, ILogService)), ( __param(4, ILoggerService))], DefaultLogLevelsService));
|
|
168
172
|
|
|
169
173
|
export { DefaultLogLevelsService };
|