1
0
Fork 1
mirror of https://gitlab.com/mangadex-pub/mangadex_at_home.git synced 2024-01-19 02:48:37 +00:00

Fine-tune logging statements

This commit is contained in:
carbotaniuman 2020-06-22 12:08:46 -05:00
parent 18f05f4ccd
commit cf58756faa
4 changed files with 16 additions and 10 deletions

View file

@ -82,7 +82,7 @@ class MangaDexClient(private val clientSettings: ClientSettings) {
LOGGER.warn("Cache version may be outdated - remove if necessary")
dieWithError(e)
} catch (e: IOException) {
LOGGER.warn("Cache version may be corrupt - remove if necessary")
LOGGER.warn("Cache may be corrupt - remove if necessary")
dieWithError(e)
}
}
@ -204,15 +204,15 @@ class MangaDexClient(private val clientSettings: ClientSettings) {
val state = this.state as Running
val newSettings = serverHandler.pingControl(state.settings)
if (LOGGER.isInfoEnabled) {
LOGGER.info("Server settings received: {}", newSettings)
}
if (newSettings != null) {
if (LOGGER.isInfoEnabled) {
LOGGER.info("Server settings received: $newSettings")
}
if (newSettings.latestBuild > Constants.CLIENT_BUILD) {
if (LOGGER.isWarnEnabled) {
LOGGER.warn(
"Outdated build detected! Latest: {}, Current: {}", newSettings.latestBuild,
Constants.CLIENT_BUILD
"Outdated build detected! Latest: ${newSettings.latestBuild}, Current: ${Constants.CLIENT_BUILD}"
)
}
}
@ -225,6 +225,10 @@ class MangaDexClient(private val clientSettings: ClientSettings) {
loginAndStartServer()
}
}
} else {
if (LOGGER.isInfoEnabled) {
LOGGER.info("Server ping failed - ignoring")
}
}
}
@ -238,8 +242,7 @@ class MangaDexClient(private val clientSettings: ClientSettings) {
if (serverSettings.latestBuild > Constants.CLIENT_BUILD) {
if (LOGGER.isWarnEnabled) {
LOGGER.warn(
"Outdated build detected! Latest: {}, Current: {}", serverSettings.latestBuild,
Constants.CLIENT_BUILD
"Outdated build detected! Latest: ${serverSettings.latestBuild}, Current: ${Constants.CLIENT_BUILD}"
)
}
}

View file

@ -24,6 +24,7 @@ import org.jetbrains.exposed.dao.id.EntityID
import org.jetbrains.exposed.dao.id.IdTable
object ImageData : IdTable<String>() {
// md5 hex strings are 32 characters long
override val id = varchar("id", 32).entityId()
override val primaryKey = PrimaryKey(id)

View file

@ -49,6 +49,7 @@ import java.io.ByteArrayInputStream
import java.io.IOException
import java.io.InputStream
import java.net.InetSocketAddress
import java.net.SocketException
import java.security.PrivateKey
import java.security.cert.CertificateFactory
import java.security.cert.X509Certificate
@ -107,12 +108,12 @@ class Netty(private val tls: TlsCert, private val clientSettings: ClientSettings
if (LOGGER.isTraceEnabled) {
LOGGER.trace("Ignored invalid SSL connection")
}
} else if (cause is IOException) {
} else if (cause is IOException || cause is SocketException) {
if (LOGGER.isInfoEnabled) {
LOGGER.info("User (downloader) abruptly closed the connection")
}
if (LOGGER.isTraceEnabled) {
LOGGER.trace("IOException in pipeline", cause)
LOGGER.trace("Exception in pipeline", cause)
}
} else {
ctx.fireExceptionCaught(cause)

View file

@ -22,6 +22,7 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategy
import com.fasterxml.jackson.databind.annotation.JsonNaming
import dev.afanasev.sekret.Secret
// client settings are verified correct in Main.kt
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy::class)
data class ClientSettings(
val maxCacheSizeInMebibytes: Long = 20480,