From 9c4aa931d5e0d5d9b4cc06b2db545b89a48be06d Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Wed, 28 Aug 2024 18:14:50 +0100 Subject: [PATCH] KE2: Move the context stack from LoggerBase to Logger This will let us have different threads with their own contexts that share a LoggerBase. --- .../src/main/kotlin/KotlinExtractor.kt | 9 --------- java/kotlin-extractor2/src/main/kotlin/utils/Logger.kt | 10 +++++----- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/java/kotlin-extractor2/src/main/kotlin/KotlinExtractor.kt b/java/kotlin-extractor2/src/main/kotlin/KotlinExtractor.kt index 3758bf37fd8..e3b17b90bd0 100644 --- a/java/kotlin-extractor2/src/main/kotlin/KotlinExtractor.kt +++ b/java/kotlin-extractor2/src/main/kotlin/KotlinExtractor.kt @@ -500,15 +500,6 @@ OLD: KE1 logger.info("Extracting file $srcFilePath") logger.flush() -/* -OLD: KE1 - val context = logger.loggerBase.extractorContextStack - if (!context.empty()) { - logger.warn("Extractor context was not empty. It thought:") - context.clear() - } -*/ - val srcFileRelativePath = PathTransformer.std().fileAsDatabaseString(File(srcFilePath)) val dbSrcFilePath = FileUtil.appendAbsolutePath(dbSrcDir, srcFileRelativePath).toPath() diff --git a/java/kotlin-extractor2/src/main/kotlin/utils/Logger.kt b/java/kotlin-extractor2/src/main/kotlin/utils/Logger.kt index 08bccf10053..e8edb4cb3f6 100644 --- a/java/kotlin-extractor2/src/main/kotlin/utils/Logger.kt +++ b/java/kotlin-extractor2/src/main/kotlin/utils/Logger.kt @@ -113,11 +113,6 @@ data class ExtractorContext( * else will use a Logger that wraps it (and the DiagnosticTrapWriter). */ open class LoggerBase(val diagnosticCounter: DiagnosticCounter) { -/* -OLD: KE1 - val extractorContextStack = Stack() -*/ - private val verbosity: Int init { @@ -325,6 +320,11 @@ OLD: KE1 * Logger is the high-level interface for writint log messages. */ open class Logger(val loggerBase: LoggerBase, val dtw: DiagnosticTrapWriter) { +/* +OLD: KE1 + val extractorContextStack = Stack() +*/ + fun flush() { dtw.flush() loggerBase.flush()