提交 169fdac3 编写于 作者: B Benjamin Pasero

file watching - tweak loggers for more useful output

上级 99188f71
......@@ -1052,7 +1052,7 @@ export class FileService extends Disposable implements IFileService {
this.undeliveredRawFileChangesEvents.push(event);
if (this.environmentService.verbose) {
console.log('%c[node.js Watcher]%c', 'color: green', 'color: black', event.type === FileChangeType.ADDED ? '[ADDED]' : event.type === FileChangeType.DELETED ? '[DELETED]' : '[CHANGED]', event.path);
console.log('%c[File Watcher (node.js)]%c', 'color: blue', 'color: black', event.type === FileChangeType.ADDED ? '[ADDED]' : event.type === FileChangeType.DELETED ? '[DELETED]' : '[CHANGED]', event.path);
}
// handle emit through delayer to accommodate for bulk changes
......@@ -1066,7 +1066,7 @@ export class FileService extends Disposable implements IFileService {
// Logging
if (this.environmentService.verbose) {
normalizedEvents.forEach(r => {
console.log('%c[node.js Watcher]%c >> normalized', 'color: green', 'color: black', r.type === FileChangeType.ADDED ? '[ADDED]' : r.type === FileChangeType.DELETED ? '[DELETED]' : '[CHANGED]', r.path);
console.log('%c[File Watcher (node.js)]%c >> normalized', 'color: blue', 'color: black', r.type === FileChangeType.ADDED ? '[ADDED]' : r.type === FileChangeType.DELETED ? '[DELETED]' : '[CHANGED]', r.path);
});
}
......
......@@ -87,10 +87,14 @@ export class NsfwWatcherService implements IWatcherService {
absolutePath = path.join(e.directory, e.oldFile);
if (!this._isPathIgnored(absolutePath, this._pathWatchers[request.basePath].ignored)) {
undeliveredFileEvents.push({ type: FileChangeType.DELETED, path: absolutePath });
} else if (this._verboseLogging) {
console.log(' >> ignored', absolutePath);
}
absolutePath = path.join(e.directory, e.newFile);
if (!this._isPathIgnored(absolutePath, this._pathWatchers[request.basePath].ignored)) {
undeliveredFileEvents.push({ type: FileChangeType.ADDED, path: absolutePath });
} else if (this._verboseLogging) {
console.log(' >> ignored', absolutePath);
}
} else {
absolutePath = path.join(e.directory, e.file);
......@@ -99,6 +103,8 @@ export class NsfwWatcherService implements IWatcherService {
type: nsfwActionToRawChangeType[e.action],
path: absolutePath
});
} else if (this._verboseLogging) {
console.log(' >> ignored', absolutePath);
}
}
}
......
......@@ -41,7 +41,7 @@ export class FileWatcher {
const client = new Client(
getPathFromAmdModule(require, 'bootstrap'),
{
serverName: 'Watcher',
serverName: 'File Watcher (nsfw)',
args: ['--type=watcherService'],
env: {
AMD_ENTRYPOINT: 'vs/workbench/services/files/node/watcher/nsfw/watcherApp',
......
......@@ -44,7 +44,7 @@ export class FileWatcher {
const client = new Client(
getPathFromAmdModule(require, 'bootstrap'),
{
serverName: 'Watcher',
serverName: 'File Watcher (chokidar)',
args,
env: {
AMD_ENTRYPOINT: 'vs/workbench/services/files/node/watcher/unix/watcherApp',
......
......@@ -61,6 +61,10 @@ export class OutOfProcessWin32FolderWatcher {
// Support ignores
if (this.ignored && this.ignored.some(ignore => glob.match(ignore, absolutePath))) {
if (this.verboseLogging) {
console.log('%c[File Watcher (C#)]', 'color: blue', ' >> ignored', absolutePath);
}
return;
}
......@@ -73,7 +77,7 @@ export class OutOfProcessWin32FolderWatcher {
// 3 Logging
else {
console.log('%c[File Watcher]', 'color: darkgreen', eventParts[1]);
console.log('%c[File Watcher (C#)]', 'color: blue', eventParts[1]);
}
}
});
......@@ -93,19 +97,19 @@ export class OutOfProcessWin32FolderWatcher {
}
private onError(error: Error | Buffer): void {
this.errorCallback('[FileWatcher] process error: ' + error.toString());
this.errorCallback('[File Watcher (C#)] process error: ' + error.toString());
}
private onExit(code: number, signal: string): void {
if (this.handle) { // exit while not yet being disposed is unexpected!
this.errorCallback(`[FileWatcher] terminated unexpectedly (code: ${code}, signal: ${signal})`);
this.errorCallback(`[File Watcher (C#)] terminated unexpectedly (code: ${code}, signal: ${signal})`);
if (this.restartCounter <= OutOfProcessWin32FolderWatcher.MAX_RESTARTS) {
this.errorCallback('[FileWatcher] is restarted again...');
this.errorCallback('[File Watcher (C#)] is restarted again...');
this.restartCounter++;
this.startWatcher(); // restart
} else {
this.errorCallback('[FileWatcher] Watcher failed to start after retrying for some time, giving up. Please report this as a bug report!');
this.errorCallback('[File Watcher (C#)] Watcher failed to start after retrying for some time, giving up. Please report this as a bug report!');
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册