mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-03-01 21:00:17 -06:00
Add some logging to the sys.watchFile and sys.watchDirectory
This commit is contained in:
parent
e293232f6a
commit
8cf8eb1720
@ -379,6 +379,9 @@ namespace ts {
|
||||
/*@internal*/
|
||||
export const ignoredPaths = ["/node_modules/.", "/.git", "/.#"];
|
||||
|
||||
/*@internal*/
|
||||
export let sysLog: (s: string) => void = noop;
|
||||
|
||||
/*@internal*/
|
||||
export interface RecursiveDirectoryWatcherHost {
|
||||
watchDirectory: HostWatchDirectory;
|
||||
@ -1053,6 +1056,7 @@ namespace ts {
|
||||
* @param createWatcher
|
||||
*/
|
||||
function invokeCallbackAndUpdateWatcher(createWatcher: () => FileWatcher) {
|
||||
sysLog(`sysLog:: ${fileOrDirectory}:: Changing watcher to ${createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing"}FileSystemEntryWatcher`);
|
||||
// Call the callback for current directory
|
||||
callback("rename", "");
|
||||
|
||||
@ -1115,6 +1119,7 @@ namespace ts {
|
||||
* Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
|
||||
*/
|
||||
function watchPresentFileSystemEntryWithFsWatchFile(): FileWatcher {
|
||||
sysLog(`sysLog:: ${fileOrDirectory}:: Changing to fsWatchFile`);
|
||||
return fallbackPollingWatchFile(fileOrDirectory, createFileWatcherCallback(callback), pollingInterval);
|
||||
}
|
||||
|
||||
|
||||
@ -370,6 +370,9 @@ namespace ts {
|
||||
const createFileWatcher: CreateFileWatcher<WatchFileHost, PollingInterval, FileWatcherEventKind, never, X, Y> = getCreateFileWatcher(watchLogLevel, watchFile);
|
||||
const createFilePathWatcher: CreateFileWatcher<WatchFileHost, PollingInterval, FileWatcherEventKind, Path, X, Y> = watchLogLevel === WatchLogLevel.None ? watchFilePath : createFileWatcher;
|
||||
const createDirectoryWatcher: CreateFileWatcher<WatchDirectoryHost, WatchDirectoryFlags, undefined, never, X, Y> = getCreateFileWatcher(watchLogLevel, watchDirectory);
|
||||
if (watchLogLevel === WatchLogLevel.Verbose && sysLog === noop) {
|
||||
sysLog = s => log(s);
|
||||
}
|
||||
return {
|
||||
watchFile: (host, file, callback, pollingInterval, detailInfo1, detailInfo2) =>
|
||||
createFileWatcher(host, file, callback, pollingInterval, /*passThrough*/ undefined, detailInfo1, detailInfo2, watchFile, log, "FileWatcher", getDetailWatchInfo),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user