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

Fix logging syntax format, run spotless

This commit is contained in:
radonbark 2020-07-19 11:45:08 -04:00
parent 71b7fd2e88
commit 1d1e9e1886

View file

@ -93,7 +93,7 @@ class MangaDexClient(private val clientSettingsFile: String) {
dieWithError(e)
} catch (ignored: IOException) {
ClientSettings().also {
LOGGER.warn("Settings file {} not found, generating file", clientSettingsFile)
LOGGER.warn { "Settings file $clientSettingsFile not found, generating file" }
try {
FileWriter(clientSettingsFile).use { writer -> JACKSON.writeValue(writer, it) }
} catch (e: IOException) {
@ -206,7 +206,7 @@ class MangaDexClient(private val clientSettingsFile: String) {
}
}
} catch (e: Exception) {
LOGGER.warn("Main loop failed", e)
LOGGER.warn(e) { "Main loop failed" }
}
}, 15, 15, TimeUnit.SECONDS)
@ -396,7 +396,7 @@ class MangaDexClient(private val clientSettingsFile: String) {
// Stop the the WebUI if needed
if (stopWebUi) {
LOGGER.info("Stopping WebUI to reload ClientSettings")
LOGGER.info { "Stopping WebUI to reload ClientSettings" }
webUi?.close()
webUi = null
}
@ -405,21 +405,21 @@ class MangaDexClient(private val clientSettingsFile: String) {
// If we are restarting the server
// We must do it gracefully and set
// the new settings later
LOGGER.info("Stopping Server to reload ClientSettings")
LOGGER.info { "Stopping Server to reload ClientSettings" }
this.state = GracefulShutdown(state, nextState = Uninitialized(clientSettings = newSettings), action = {
serverHandler.setClientSettings(newSettings)
LOGGER.info("Reloaded ClientSettings: {}", newSettings)
LOGGER.info { "Reloaded ClientSettings: $newSettings" }
LOGGER.info("Starting Server after reloading ClientSettings")
LOGGER.info { "Starting Server after reloading ClientSettings" }
loginAndStartServer()
// Start the WebUI if we had to stop it
// and still want it
if (startWebUi) {
LOGGER.info("Starting WebUI after reloading ClientSettings")
LOGGER.info { "Starting WebUI after reloading ClientSettings" }
startWebUi()
LOGGER.info("Started WebUI after reloading ClientSettings")
LOGGER.info { "Started WebUI after reloading ClientSettings" }
}
})
} else {
@ -427,24 +427,24 @@ class MangaDexClient(private val clientSettingsFile: String) {
// We can update the settings now
this.state = state.copy(clientSettings = newSettings)
serverHandler.setClientSettings(newSettings)
LOGGER.info("Reloaded ClientSettings: {}", newSettings)
LOGGER.info { "Reloaded ClientSettings: $newSettings" }
// Start the WebUI if we had to stop it
// and still want it
if (startWebUi) {
LOGGER.info("Starting WebUI after reloading ClientSettings")
LOGGER.info { "Starting WebUI after reloading ClientSettings" }
startWebUi()
LOGGER.info("Started WebUI after reloading ClientSettings")
LOGGER.info { "Started WebUI after reloading ClientSettings" }
}
}
} catch (e: UnrecognizedPropertyException) {
LOGGER.warn("Settings file is invalid: '${e.propertyName}' is not a valid setting")
LOGGER.warn { "Settings file is invalid: '$e.propertyName' is not a valid setting" }
} catch (e: JsonProcessingException) {
LOGGER.warn("Settings file is invalid: {}", e.message)
LOGGER.warn { "Settings file is invalid: $e.message" }
} catch (e: IOException) {
LOGGER.warn("Settings file is could not be found: {}", e.message)
LOGGER.warn { "Settings file is could not be found: $e.message" }
} catch (e: ClientSettingsException) {
LOGGER.warn("Can't reload client settings: " + e.message)
LOGGER.warn { "Can't reload client settings: $e.message" }
}
}
@ -463,7 +463,7 @@ class MangaDexClient(private val clientSettingsFile: String) {
throw ClientSettingsException("Config Error: Invalid number of threads, must be >= 4")
}
if (settings.maxMebibytesPerHour < 0) {
dieWithError("Config Error: Max bandwidth must be >= 0")
throw ClientSettingsException("Config Error: Max bandwidth must be >= 0")
}
if (settings.maxKilobitsPerSecond < 0) {
throw ClientSettingsException("Config Error: Max burst rate must be >= 0")