Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Revert changing log level in FileUtils.kt #2801

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
package com.pinterest.ktlint.cli.internal

import ch.qos.logback.classic.Level
import ch.qos.logback.classic.Logger
import com.pinterest.ktlint.logger.api.initKtLintKLogger
import com.pinterest.ktlint.logger.api.setDefaultLoggerModifier
import io.github.oshai.kotlinlogging.DelegatingKLogger
import io.github.oshai.kotlinlogging.KLogger
import io.github.oshai.kotlinlogging.KotlinLogging
import org.jetbrains.kotlin.util.prefixIfNot
import java.io.File
Expand All @@ -25,22 +20,7 @@ import kotlin.io.path.pathString
import kotlin.io.path.relativeToOrSelf
import kotlin.system.measureTimeMillis

private val LOGGER =
KotlinLogging
.logger {}
.setDefaultLoggerModifier { it.level = Level.TRACE }
.initKtLintKLogger()

private var KLogger.level: Level?
get() = underlyingLogger()?.level
set(value) {
underlyingLogger()?.level = value
}

private fun KLogger.underlyingLogger(): Logger? =
@Suppress("UNCHECKED_CAST")
(this as? DelegatingKLogger<Logger>)
?.underlyingLogger
private val LOGGER = KotlinLogging.logger {}.initKtLintKLogger()

private val ROOT_DIR_PATH: Path = Paths.get("").toAbsolutePath()

Expand Down