mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Unused log functions.
This commit is contained in:
parent
5545d8e41b
commit
6c1afbfd99
2 changed files with 15 additions and 46 deletions
|
@ -4,51 +4,6 @@ import com.beust.kobalt.api.Kobalt
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
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) {
|
fun Any.log(level: Int, text: String, newLine : Boolean = true) {
|
||||||
if (level <= KobaltLogger.LOG_LEVEL) {
|
if (level <= KobaltLogger.LOG_LEVEL) {
|
||||||
KobaltLogger.logger.log(javaClass.simpleName, text, newLine)
|
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)
|
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) {
|
class Logger(val dev: Boolean) {
|
||||||
val FORMAT = SimpleDateFormat("HH:mm:ss.SSS")
|
val FORMAT = SimpleDateFormat("HH:mm:ss.SSS")
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.beust.kobalt.internal
|
||||||
import com.beust.kobalt.maven.KobaltException
|
import com.beust.kobalt.maven.KobaltException
|
||||||
import com.beust.kobalt.misc.KobaltLogger
|
import com.beust.kobalt.misc.KobaltLogger
|
||||||
import com.beust.kobalt.misc.Topological
|
import com.beust.kobalt.misc.Topological
|
||||||
|
import com.beust.kobalt.misc.log
|
||||||
import javafx.concurrent.Worker
|
import javafx.concurrent.Worker
|
||||||
import org.testng.Assert
|
import org.testng.Assert
|
||||||
import org.testng.annotations.Test
|
import org.testng.annotations.Test
|
||||||
|
@ -34,7 +35,7 @@ public class DynamicGraphTest {
|
||||||
override val priority = 0
|
override val priority = 0
|
||||||
|
|
||||||
override fun call() : TaskResult2<T> {
|
override fun call() : TaskResult2<T> {
|
||||||
KobaltLogger.log(2, "Running node $n")
|
log(2, "Running node $n")
|
||||||
runNodes.add(n)
|
runNodes.add(n)
|
||||||
return TaskResult2(errorFunction(n), n)
|
return TaskResult2(errorFunction(n), n)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue