From 16f125a30d1293ab8ac2e5c24f7aeaa45e335547 Mon Sep 17 00:00:00 2001 From: Huafu Gandon Date: Sun, 2 Sep 2018 22:26:19 +0200 Subject: [PATCH] fix(testing): change logging level for some utility --- .../__snapshots__/logger.test.ts.snap | 166 ---- e2e/__tests__/logger.test.ts | 11 +- src/compiler.spec.ts | 722 +----------------- src/compiler.ts | 10 +- 4 files changed, 17 insertions(+), 892 deletions(-) diff --git a/e2e/__tests__/__snapshots__/logger.test.ts.snap b/e2e/__tests__/__snapshots__/logger.test.ts.snap index 99fe916a55..5cf91db511 100644 --- a/e2e/__tests__/__snapshots__/logger.test.ts.snap +++ b/e2e/__tests__/__snapshots__/logger.test.ts.snap @@ -25,50 +25,16 @@ Array [ "[level:20] readThrough(): cache miss", "[level:20] getOutput(): compiling using language service", "[level:20] updateMemoryCache()", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] readFile", - "[level:20] readFile", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", "[level:20] visitSourceFileNode(): hoisting", "[level:20] getOutput(): computing diagnostics", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] readThrough(): writing caches", "[level:20] computing cache key for /Hello.ts", "[level:20] processing /Hello.ts", "[level:20] readThrough(): cache miss", "[level:20] getOutput(): compiling using language service", "[level:20] updateMemoryCache()", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] visitSourceFileNode(): hoisting", "[level:20] getOutput(): computing diagnostics", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] readThrough(): writing caches", ] `; @@ -107,30 +73,8 @@ Array [ "[level:20] readThrough(): cache miss", "[level:20] getOutput(): compiling using language service", "[level:20] updateMemoryCache()", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] readFile", - "[level:20] readFile", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", "[level:20] visitSourceFileNode(): hoisting", "[level:20] getOutput(): computing diagnostics", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] readThrough(): writing caches", "[level:20] calling babel-jest processor", "[level:20] computing cache key for /Hello.ts", @@ -138,20 +82,8 @@ Array [ "[level:20] readThrough(): cache miss", "[level:20] getOutput(): compiling using language service", "[level:20] updateMemoryCache()", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] visitSourceFileNode(): hoisting", "[level:20] getOutput(): computing diagnostics", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] readThrough(): writing caches", "[level:20] calling babel-jest processor", ] @@ -190,30 +122,8 @@ Array [ "[level:20] readThrough(): cache miss", "[level:20] getOutput(): compiling using language service", "[level:20] updateMemoryCache()", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] readFile", - "[level:20] readFile", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", "[level:20] visitSourceFileNode(): hoisting", "[level:20] getOutput(): computing diagnostics", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] readThrough(): writing caches", "[level:20] calling babel-jest processor", "[level:20] computing cache key for /Hello.ts", @@ -221,20 +131,8 @@ Array [ "[level:20] readThrough(): cache miss", "[level:20] getOutput(): compiling using language service", "[level:20] updateMemoryCache()", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] visitSourceFileNode(): hoisting", "[level:20] getOutput(): computing diagnostics", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] readThrough(): writing caches", "[level:20] calling babel-jest processor", ] @@ -264,50 +162,16 @@ Array [ "[level:20] readThrough(): cache miss", "[level:20] getOutput(): compiling using language service", "[level:20] updateMemoryCache()", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] readFile", - "[level:20] readFile", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", "[level:20] visitSourceFileNode(): hoisting", "[level:20] getOutput(): computing diagnostics", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] readThrough(): writing caches", "[level:20] computing cache key for /Hello.ts", "[level:20] processing /Hello.ts", "[level:20] readThrough(): cache miss", "[level:20] getOutput(): compiling using language service", "[level:20] updateMemoryCache()", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] visitSourceFileNode(): hoisting", "[level:20] getOutput(): computing diagnostics", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] readThrough(): writing caches", ] `; @@ -337,46 +201,16 @@ Array [ "[level:20] readThrough(): cache miss", "[level:20] getOutput(): compiling using language service", "[level:20] updateMemoryCache()", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] readFile", - "[level:20] readFile", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", - "[level:20] getScriptSnapshot(): cache miss", "[level:20] visitSourceFileNode(): hoisting", "[level:20] getOutput(): computing diagnostics", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] readThrough(): writing caches", "[level:20] computing cache key for /Hello.ts", "[level:20] processing /Hello.ts", "[level:20] readThrough(): cache miss", "[level:20] getOutput(): compiling using language service", "[level:20] updateMemoryCache()", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] visitSourceFileNode(): hoisting", "[level:20] getOutput(): computing diagnostics", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", - "[level:20] getScriptSnapshot(): cache hit", "[level:20] readThrough(): writing caches", ] `; diff --git a/e2e/__tests__/logger.test.ts b/e2e/__tests__/logger.test.ts index 6549f890ad..69b51385b9 100644 --- a/e2e/__tests__/logger.test.ts +++ b/e2e/__tests__/logger.test.ts @@ -1,7 +1,7 @@ import { configureTestCase } from '../__helpers__/test-case' import { PackageSets, allValidPackageSets } from '../__helpers__/templates' import { existsSync } from 'fs' -import { LogContexts } from 'bs-logger' +import { LogContexts, LogLevels } from 'bs-logger' describe('With unsupported version test', () => { const testCase = configureTestCase('simple') @@ -23,9 +23,12 @@ describe('TS_JEST_LOG', () => { const result = runTest() expect(result.status).toBe(0) expect(existsSync(result.logFilePath)) - expect(result.logFileEntries.map( - e => result.normalize(`[level:${e.context[LogContexts.logLevel]}] ${e.message}`), - )).toMatchSnapshot() + const filteredEntries = result.logFileEntries + // keep only debu and above + .filter(m => (m.context[LogContexts.logLevel] || 0) >= LogLevels.debug) + // simplify entires + .map(e => result.normalize(`[level:${e.context[LogContexts.logLevel]}] ${e.message}`)) + expect(filteredEntries).toMatchSnapshot() }) }) }) diff --git a/src/compiler.spec.ts b/src/compiler.spec.ts index ec9f6b8307..31e61907f5 100644 --- a/src/compiler.spec.ts +++ b/src/compiler.spec.ts @@ -6,6 +6,7 @@ import { createCompiler } from './compiler' import { relativeToRoot, tempDir } from './__helpers__/path' import ProcessedSource from './__helpers__/processed-source' import { logTargetMock } from './__helpers__/mocks' +import { LogLevels } from 'bs-logger' const logTarget = logTargetMock() @@ -79,735 +80,18 @@ describe('cache', () => { it('should use the cache', () => { const compiled1 = compiler.compile(source, __filename) - expect(logTarget.lines).toMatchInlineSnapshot(` + expect(logTarget.filteredLines(LogLevels.debug, Infinity)) + .toMatchInlineSnapshot(` Array [ "[level:20] readThrough(): cache miss ", "[level:20] getOutput(): compiling using language service ", "[level:20] updateMemoryCache() -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] readFile -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss -", - "[level:20] getScriptSnapshot(): cache miss ", "[level:20] visitSourceFileNode(): hoisting ", "[level:20] getOutput(): computing diagnostics -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit -", - "[level:20] getScriptSnapshot(): cache hit ", "[level:20] readThrough(): writing caches ", diff --git a/src/compiler.ts b/src/compiler.ts index f48508a59f..f71616b323 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -140,11 +140,15 @@ export function createCompiler(configs: ConfigSet): TsCompiler { } // Create the compiler host for type checking. - const serviceHostCtx = { + const serviceHostDebugCtx = { [LogContexts.logLevel]: LogLevels.debug, namespace: 'ts:serviceHost', call: null, } + const serviceHostTraceCtx = { + ...serviceHostDebugCtx, + [LogContexts.logLevel]: LogLevels.trace, + } const serviceHost = { getScriptFileNames: () => Object.keys(memoryCache.versions), getScriptVersion: (fileName: string) => { @@ -161,7 +165,7 @@ export function createCompiler(configs: ConfigSet): TsCompiler { }, getScriptSnapshot(fileName: string) { const hit = hasOwn.call(memoryCache.contents, fileName) - logger.debug( + logger.trace( { fileName, cacheHit: hit }, `getScriptSnapshot():`, 'cache', @@ -179,7 +183,7 @@ export function createCompiler(configs: ConfigSet): TsCompiler { return ts.ScriptSnapshot.fromString(contents) }, fileExists: ts.sys.fileExists, - readFile: logger.wrap(serviceHostCtx, 'readFile', ts.sys.readFile), + readFile: logger.wrap(serviceHostTraceCtx, 'readFile', ts.sys.readFile), readDirectory: ts.sys.readDirectory, getDirectories: ts.sys.getDirectories, directoryExists: ts.sys.directoryExists,