Removed KotlinLogging (it has a niche usage that did not apply)

This commit is contained in:
Robinson 2023-09-13 16:13:32 +02:00
parent c942328293
commit 6017331f6b
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
10 changed files with 27 additions and 36 deletions

View File

@ -5,12 +5,6 @@
Dorkbox LLC Dorkbox LLC
Extra license information Extra license information
- kotlin-logging - Lightweight logging framework for Kotlin
[The Apache Software License, Version 2.0]
https://github.com/MicroUtils/kotlin-logging
Copyright 2023
Ohad Shai
- Kryo - Fast and efficient binary object graph serialization framework for Java - Kryo - Fast and efficient binary object graph serialization framework for Java
[BSD 3-Clause License] [BSD 3-Clause License]
https://github.com/EsotericSoftware/kryo https://github.com/EsotericSoftware/kryo

View File

@ -97,9 +97,7 @@ dependencies {
// compileOnly("net.openhft:chronicle-map:3.21.86") // compileOnly("net.openhft:chronicle-map:3.21.86")
// https://github.com/MicroUtils/kotlin-logging implementation("org.slf4j:slf4j-api:2.0.9")
api("io.github.microutils:kotlin-logging:3.0.5")
implementation("org.slf4j:slf4j-api:2.0.7")
api("com.esotericsoftware:kryo:5.5.0") { api("com.esotericsoftware:kryo:5.5.0") {

View File

@ -20,15 +20,15 @@ import dorkbox.bytes.encodeToBase58String
import dorkbox.storage.serializer.SerializerBytes import dorkbox.storage.serializer.SerializerBytes
import dorkbox.storage.types.MemoryStore import dorkbox.storage.types.MemoryStore
import dorkbox.storage.types.PropertyStore import dorkbox.storage.types.PropertyStore
import mu.KLogger import org.slf4j.Logger
import mu.KotlinLogging import org.slf4j.LoggerFactory
import org.slf4j.helpers.NOPLogger import org.slf4j.helpers.NOPLogger
import java.io.File import java.io.File
typealias AccessFunc = ((serializer: SerializerBytes, key: Any, value: Any?, load: (key: Any, value: Any?) -> Unit) -> Unit) typealias AccessFunc = ((serializer: SerializerBytes, key: Any, value: Any?, load: (key: Any, value: Any?) -> Unit) -> Unit)
abstract class Storage(val logger: KLogger) : AutoCloseable { abstract class Storage(val logger: Logger) : AutoCloseable {
companion object { companion object {
/** /**
* Gets the version number. * Gets the version number.
@ -42,7 +42,7 @@ abstract class Storage(val logger: KLogger) : AutoCloseable {
const val versionTag = "__VERSION__" const val versionTag = "__VERSION__"
private val defaultLogger: KLogger = KotlinLogging.logger(NOPLogger.NOP_LOGGER) private val defaultLogger: Logger = NOPLogger.NOP_LOGGER
} }
fun init(initMessage: String) { fun init(initMessage: String) {
@ -51,7 +51,7 @@ abstract class Storage(val logger: KLogger) : AutoCloseable {
setVersion(0L) setVersion(0L)
} }
KotlinLogging.logger("Storage").info(initMessage) LoggerFactory.getLogger("Storage").info(initMessage)
} }
/** /**
@ -165,7 +165,7 @@ abstract class Storage(val logger: KLogger) : AutoCloseable {
/** /**
* Assigns a logger to use for the storage system. The default is a No Operation (NOP) logger which will ignore everything. * Assigns a logger to use for the storage system. The default is a No Operation (NOP) logger which will ignore everything.
*/ */
fun logger(logger: KLogger): Builder fun logger(logger: Logger): Builder
} }
@ -184,7 +184,7 @@ abstract class Storage(val logger: KLogger) : AutoCloseable {
@Volatile @Volatile
var sharedBuild: Storage? = null var sharedBuild: Storage? = null
var logger: KLogger = defaultLogger var logger: Logger = defaultLogger
var file = File("storage.db") var file = File("storage.db")
var readOnly = false var readOnly = false
@ -224,7 +224,7 @@ abstract class Storage(val logger: KLogger) : AutoCloseable {
return this return this
} }
override fun logger(logger: KLogger): B { override fun logger(logger: Logger): B {
this.logger = logger this.logger = logger
return this as B return this as B
} }
@ -304,7 +304,7 @@ abstract class Storage(val logger: KLogger) : AutoCloseable {
* This storage system DOES NOT care about serializing data, so `register` has no effect. * This storage system DOES NOT care about serializing data, so `register` has no effect.
*/ */
class Memory : Builder { class Memory : Builder {
private var logger: KLogger = defaultLogger private var logger: Logger = defaultLogger
private var shared = false private var shared = false
@Volatile private var sharedBuild: Storage? = null @Volatile private var sharedBuild: Storage? = null
@ -344,7 +344,7 @@ abstract class Storage(val logger: KLogger) : AutoCloseable {
/** /**
* Assigns a logger to use for the storage system. If null, then only errors will be logged to the error console. * Assigns a logger to use for the storage system. If null, then only errors will be logged to the error console.
*/ */
override fun logger(logger: KLogger): Builder { override fun logger(logger: Logger): Builder {
this.logger = logger this.logger = logger
return this return this
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2021 dorkbox, llc * Copyright 2023 dorkbox, llc
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,7 +20,7 @@ import com.esotericsoftware.kryo.io.ByteBufferOutput
import com.esotericsoftware.kryo.io.Input import com.esotericsoftware.kryo.io.Input
import com.esotericsoftware.kryo.io.Output import com.esotericsoftware.kryo.io.Output
import dorkbox.storage.Storage import dorkbox.storage.Storage
import mu.KLogger import org.slf4j.Logger
import java.io.File import java.io.File
/** /**
@ -31,7 +31,7 @@ import java.io.File
class ChronicleMapStore( class ChronicleMapStore(
val dbFile: File, val dbFile: File,
val readOnly: Boolean, val readOnly: Boolean,
logger: KLogger logger: Logger
) : Storage(logger) { ) : Storage(logger) {
// private val map = ChronicleMap.of(String::class.java, ByteArray::class.java) // private val map = ChronicleMap.of(String::class.java, ByteArray::class.java)

View File

@ -19,7 +19,7 @@ import dorkbox.json.JsonException
import dorkbox.json.OutputType import dorkbox.json.OutputType
import dorkbox.storage.AccessFunc import dorkbox.storage.AccessFunc
import dorkbox.storage.Storage import dorkbox.storage.Storage
import mu.KLogger import org.slf4j.Logger
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
import java.util.concurrent.* import java.util.concurrent.*
@ -32,7 +32,7 @@ class JsonStore(
val autoLoad: Boolean, val autoLoad: Boolean,
val readOnly: Boolean, val readOnly: Boolean,
val readOnlyViolent: Boolean, val readOnlyViolent: Boolean,
logger: KLogger, logger: Logger,
onLoad: AccessFunc, onLoad: AccessFunc,
onSave: AccessFunc, onSave: AccessFunc,
) : Storage(logger) { ) : Storage(logger) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2021 dorkbox, llc * Copyright 2023 dorkbox, llc
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,7 +16,7 @@
package dorkbox.storage.types package dorkbox.storage.types
import dorkbox.storage.Storage import dorkbox.storage.Storage
import mu.KLogger import org.slf4j.Logger
import java.io.File import java.io.File
/** /**
@ -27,7 +27,7 @@ import java.io.File
class LmdbStore( class LmdbStore(
val dbFile: File, val dbFile: File,
val readOnly: Boolean, val readOnly: Boolean,
logger: KLogger logger: Logger
) : Storage(logger) { ) : Storage(logger) {
// private val env: Env<ByteArray> // private val env: Env<ByteArray>

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2021 dorkbox, llc * Copyright 2023 dorkbox, llc
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,14 +16,14 @@
package dorkbox.storage.types package dorkbox.storage.types
import dorkbox.storage.Storage import dorkbox.storage.Storage
import mu.KLogger import org.slf4j.Logger
import java.io.File import java.io.File
import java.util.concurrent.* import java.util.concurrent.*
/** /**
* In-Memory storage * In-Memory storage
*/ */
class MemoryStore(logger: KLogger) : Storage(logger) { class MemoryStore(logger: Logger) : Storage(logger) {
private val map = ConcurrentHashMap<Any, Any>() private val map = ConcurrentHashMap<Any, Any>()
init { init {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2021 dorkbox, llc * Copyright 2023 dorkbox, llc
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,7 +17,7 @@ package dorkbox.storage.types
import dorkbox.storage.AccessFunc import dorkbox.storage.AccessFunc
import dorkbox.storage.serializer.SerializerBytes import dorkbox.storage.serializer.SerializerBytes
import mu.KLogger import org.slf4j.Logger
import java.io.File import java.io.File
import java.io.FileInputStream import java.io.FileInputStream
import java.io.FileOutputStream import java.io.FileOutputStream
@ -31,7 +31,7 @@ class PropertyStore(
autoLoad: Boolean, autoLoad: Boolean,
readOnly: Boolean, readOnly: Boolean,
readOnlyViolent: Boolean, readOnlyViolent: Boolean,
logger: KLogger, logger: Logger,
serializer: SerializerBytes, serializer: SerializerBytes,
onLoad: AccessFunc, onLoad: AccessFunc,
onSave: AccessFunc, onSave: AccessFunc,

View File

@ -18,7 +18,7 @@ package dorkbox.storage.types
import dorkbox.storage.AccessFunc import dorkbox.storage.AccessFunc
import dorkbox.storage.Storage import dorkbox.storage.Storage
import dorkbox.storage.serializer.SerializerBytes import dorkbox.storage.serializer.SerializerBytes
import mu.KLogger import org.slf4j.Logger
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
import java.util.concurrent.* import java.util.concurrent.*
@ -31,7 +31,7 @@ abstract class StringStore(
val autoLoad: Boolean, val autoLoad: Boolean,
val readOnly: Boolean, val readOnly: Boolean,
val readOnlyViolent: Boolean, val readOnlyViolent: Boolean,
logger: KLogger, logger: Logger,
val serializer: SerializerBytes, val serializer: SerializerBytes,
val onLoad: AccessFunc, val onLoad: AccessFunc,
val onSave: AccessFunc, val onSave: AccessFunc,

View File

@ -12,7 +12,6 @@ module dorkbox.storage {
requires transitive com.esotericsoftware.kryo; requires transitive com.esotericsoftware.kryo;
requires transitive org.slf4j; requires transitive org.slf4j;
requires transitive io.github.microutils.kotlinlogging;
requires transitive kotlin.stdlib; requires transitive kotlin.stdlib;
} }