Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

Commit

Permalink
1.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
sokomishalov committed Sep 20, 2019
1 parent 6ecdc72 commit 9b60ecc
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions commons-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<parent>
<groupId>ru.sokomishalov.commons</groupId>
<artifactId>commons-parent</artifactId>
<version>1.0.5</version>
<version>1.0.7</version>
</parent>

<artifactId>commons-core</artifactId>
<version>1.0.5</version>
<version>1.0.7</version>

<properties>
<kotlin.version>1.3.50</kotlin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ fun ZipInputStream.toIterableEntries(): Iterable<ZipEntry> = object : Iterable<Z
return next != null
}

override operator fun next(): ZipEntry {
return next ?: throw NoSuchElementException()
}
override operator fun next(): ZipEntry = next ?: throw NoSuchElementException()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package ru.sokomishalov.commons.core.log

import io.github.classgraph.ClassGraph
import org.slf4j.Logger
import java.util.concurrent.ConcurrentHashMap

/**
* @author sokomishalov
*/
object CustomLoggerFactory {

private val loggersMap: MutableMap<String, Logger> = mutableMapOf()
private val loggersMap: MutableMap<String, Logger> = ConcurrentHashMap()

init {
ClassGraph()
Expand All @@ -21,5 +22,15 @@ object CustomLoggerFactory {

}

fun <T : Loggable> getLogger(clazz: Class<T>): Logger = loggersMap[clazz.name] ?: loggerFor(clazz)
fun <T : Loggable> getLogger(clazz: Class<T>): Logger {
val logger = loggersMap[clazz.name]
return when {
logger != null -> logger
else -> {
val newLogger = loggerFor(clazz)
loggersMap[clazz.name] = newLogger
newLogger
}
}
}
}
6 changes: 3 additions & 3 deletions commons-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<parent>
<groupId>ru.sokomishalov.commons</groupId>
<artifactId>commons-parent</artifactId>
<version>1.0.5</version>
<version>1.0.7</version>
</parent>

<artifactId>commons-spring</artifactId>
<version>1.0.5</version>
<version>1.0.7</version>

<properties>
<kotlin.version>1.3.50</kotlin.version>
Expand All @@ -25,7 +25,7 @@
<dependency>
<groupId>ru.sokomishalov.commons</groupId>
<artifactId>commons-core</artifactId>
<version>1.0.5</version>
<version>1.0.7</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>ru.sokomishalov.commons</groupId>
<artifactId>commons-parent</artifactId>
<version>1.0.5</version>
<version>1.0.7</version>
<packaging>pom</packaging>

<properties>
Expand Down

0 comments on commit 9b60ecc

Please sign in to comment.