Skip to content

Commit

Permalink
refactor(helper-cli): Replace ORT's logger extension function with Lo…
Browse files Browse the repository at this point in the history
…g4j's

This reduces code duplication and aligns with ORT's main CLI.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Oct 16, 2023
1 parent c149679 commit 3b66aa8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.required
import com.github.ajalt.clikt.parameters.types.file

import org.ossreviewtoolkit.helper.utils.logger
import org.apache.logging.log4j.kotlin.logger

import org.ossreviewtoolkit.model.Identifier
import org.ossreviewtoolkit.model.Package
import org.ossreviewtoolkit.model.config.OrtConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import com.github.ajalt.clikt.parameters.options.split
import com.github.ajalt.clikt.parameters.types.enum
import com.github.ajalt.clikt.parameters.types.file

import org.apache.logging.log4j.kotlin.logger

import org.jetbrains.exposed.sql.Database
import org.jetbrains.exposed.sql.SqlExpressionBuilder.inList
import org.jetbrains.exposed.sql.SqlExpressionBuilder.isNotNull
Expand All @@ -40,7 +42,6 @@ import org.jetbrains.exposed.sql.select

import org.ossreviewtoolkit.helper.utils.ORTH_NAME
import org.ossreviewtoolkit.helper.utils.execAndMap
import org.ossreviewtoolkit.helper.utils.logger
import org.ossreviewtoolkit.model.SourceCodeOrigin
import org.ossreviewtoolkit.model.config.OrtConfiguration
import org.ossreviewtoolkit.model.config.PostgresStorageConfiguration
Expand Down
10 changes: 0 additions & 10 deletions helper-cli/src/main/kotlin/utils/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,12 @@ package org.ossreviewtoolkit.helper.utils
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator

import com.github.ajalt.clikt.core.CliktCommand

import java.io.File
import java.nio.file.Paths
import java.sql.ResultSet

import kotlin.io.path.createTempDirectory

import org.apache.logging.log4j.kotlin.cachedLoggerOf

import org.jetbrains.exposed.sql.transactions.TransactionManager

import org.ossreviewtoolkit.analyzer.PackageManager
Expand Down Expand Up @@ -77,12 +73,6 @@ import org.ossreviewtoolkit.utils.ort.CopyrightStatementsProcessor
import org.ossreviewtoolkit.utils.spdx.SpdxExpression
import org.ossreviewtoolkit.utils.spdx.SpdxSingleLicenseExpression

/**
* An extension property for adding a logger property to any [CliktCommand].
*/
val CliktCommand.logger
inline get() = cachedLoggerOf(javaClass)

/**
* Return an approximated minimal sublist of [this] so that the result still matches the exact same entries of the given
* [projectScopes].
Expand Down

0 comments on commit 3b66aa8

Please sign in to comment.