From 6c1afbfd99c40fe7aee25fff07cc8918b4aff426 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Thu, 15 Oct 2015 02:58:08 -0700 Subject: [PATCH] Unused log functions. --- .../com/beust/kobalt/misc/KobaltLogger.kt | 58 +++++-------------- .../beust/kobalt/internal/DynamicGraphTest.kt | 3 +- 2 files changed, 15 insertions(+), 46 deletions(-) diff --git a/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt b/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt index bb57bc0c..68cf4a77 100644 --- a/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt +++ b/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt @@ -4,51 +4,6 @@ import com.beust.kobalt.api.Kobalt import java.text.SimpleDateFormat import java.util.* -interface KobaltLogger { - companion object { - public var LOG_LEVEL : Int = 1 - - val logger : Logger get() = - if (Kobalt.context != null) { - Logger(Kobalt.context!!.args.dev) - } else { - Logger(false) - } - - fun log(level: Int, s: String, newLine: Boolean = true) { - if (level <= LOG_LEVEL) { - logger.log("Logger", s, newLine) - } - } - - fun warn(s: String, e: Throwable? = null) { - logger.warn("Logger", s, e) - } - - fun debug(s: String) { - logger.debug(s) - } - } - -// final fun log(level: Int = 1, message: String) { -// if (level <= LOG_LEVEL) { -// logger.log("Logger", message) -// } -// } -// -// final fun debug(message: String) { -// logger.debug(message) -// } -// -// final fun error(message: String, e: Throwable? = null) { -// logger.error("Logger", "***** $message", e) -// } -// -// final fun warn(message: String, e: Throwable? = null) { -// logger.warn("Logger", message, e) -// } -} - fun Any.log(level: Int, text: String, newLine : Boolean = true) { if (level <= KobaltLogger.LOG_LEVEL) { KobaltLogger.logger.log(javaClass.simpleName, text, newLine) @@ -67,6 +22,19 @@ fun Any.error(text: String, e: Throwable? = null) { KobaltLogger.logger.error(javaClass.simpleName, text, e) } +interface KobaltLogger { + companion object { + public var LOG_LEVEL: Int = 1 + + val logger: Logger get() = + if (Kobalt.context != null) { + Logger(Kobalt.context!!.args.dev) + } else { + Logger(false) + } + } +} + class Logger(val dev: Boolean) { val FORMAT = SimpleDateFormat("HH:mm:ss.SSS") diff --git a/src/test/kotlin/com/beust/kobalt/internal/DynamicGraphTest.kt b/src/test/kotlin/com/beust/kobalt/internal/DynamicGraphTest.kt index 81965fe6..a1695679 100644 --- a/src/test/kotlin/com/beust/kobalt/internal/DynamicGraphTest.kt +++ b/src/test/kotlin/com/beust/kobalt/internal/DynamicGraphTest.kt @@ -3,6 +3,7 @@ package com.beust.kobalt.internal import com.beust.kobalt.maven.KobaltException import com.beust.kobalt.misc.KobaltLogger import com.beust.kobalt.misc.Topological +import com.beust.kobalt.misc.log import javafx.concurrent.Worker import org.testng.Assert import org.testng.annotations.Test @@ -34,7 +35,7 @@ public class DynamicGraphTest { override val priority = 0 override fun call() : TaskResult2 { - KobaltLogger.log(2, "Running node $n") + log(2, "Running node $n") runNodes.add(n) return TaskResult2(errorFunction(n), n) }