mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2026-01-31 07:54:19 +01:00
Feature/reduce logging (#1667)
* Reduce Hikari related logging * Reduce WebView related logging
This commit is contained in:
@@ -135,7 +135,7 @@ class KcefWebView {
|
||||
ConsoleEvent(level.ordinal, message, source, line),
|
||||
),
|
||||
)
|
||||
logger.debug { "$source:$line: $message" }
|
||||
logger.trace { "$source:$line: $message" }
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ class KcefWebView {
|
||||
frame: CefFrame,
|
||||
httpStatusCode: Int,
|
||||
) {
|
||||
logger.info { "Load event: ${frame.name} - ${frame.url}" }
|
||||
logger.trace { "Load event: ${frame.name} - ${frame.url}" }
|
||||
if (httpStatusCode > 0 && frame.isMain) handleLoad(frame.url, httpStatusCode)
|
||||
flush()
|
||||
}
|
||||
@@ -199,7 +199,7 @@ class KcefWebView {
|
||||
requestInitiator: String,
|
||||
disableDefaultHandling: BoolRef,
|
||||
): CefResourceRequestHandler? {
|
||||
logger.info { "Load resource: ${frame.name} - ${request.url}" }
|
||||
logger.trace { "Load resource: ${frame.name} - ${request.url}" }
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -253,7 +253,7 @@ class KcefWebView {
|
||||
addRequestHandler(RequestHandler())
|
||||
}
|
||||
|
||||
logger.info { "Start loading cookies" }
|
||||
logger.debug { "Start loading cookies" }
|
||||
CefCookieManager.getGlobalManager().apply {
|
||||
val cookies = networkHelper.cookieStore.getStoredCookies()
|
||||
for (cookie in cookies) {
|
||||
@@ -307,7 +307,7 @@ class KcefWebView {
|
||||
|
||||
private fun flush() {
|
||||
if (browser == null) return
|
||||
logger.info { "Start cookie flush" }
|
||||
logger.trace { "Start cookie flush" }
|
||||
CefCookieManager.getGlobalManager().visitAllCookies { it, _, _, _ ->
|
||||
try {
|
||||
networkHelper.cookieStore.addAll(
|
||||
@@ -631,7 +631,7 @@ class KcefWebView {
|
||||
error: String? = null,
|
||||
) {
|
||||
browser!!.evaluateJavaScript("return document.title") {
|
||||
logger.info { "Load finished with title $it" }
|
||||
logger.trace { "Load finished with title $it" }
|
||||
WebView.notifyAllClients(
|
||||
Json.encodeToString<Event>(
|
||||
LoadEvent(url, it ?: "", status, error),
|
||||
|
||||
@@ -102,11 +102,10 @@ object WebView : Websocket<String>() {
|
||||
val url = event.url
|
||||
dr.loadUrl(url)
|
||||
dr.resize(event.width, event.height)
|
||||
logger.info { "Loading URL $url" }
|
||||
logger.debug { "Loading URL $url" }
|
||||
}
|
||||
is ResizeMessage -> {
|
||||
dr.resize(event.width, event.height)
|
||||
logger.info { "Resize browser" }
|
||||
}
|
||||
is JsEventMessage -> {
|
||||
dr.event(event)
|
||||
|
||||
@@ -437,8 +437,8 @@ fun applicationSetup() {
|
||||
|
||||
runMigrations(applicationDirs)
|
||||
|
||||
// Disable jetty's logging
|
||||
setLogLevelFor("org.eclipse.jetty", Level.OFF)
|
||||
setLogLevelFor("com.zaxxer.hikari", Level.WARN)
|
||||
|
||||
// socks proxy settings
|
||||
serverConfig.subscribeTo(
|
||||
|
||||
@@ -133,13 +133,13 @@ fun databaseUp() {
|
||||
|
||||
// Log pool statistics
|
||||
DBManager.getPoolStats()?.let { stats ->
|
||||
logger.info { "HikariCP initialized: $stats" }
|
||||
logger.debug { "HikariCP initialized: $stats" }
|
||||
}
|
||||
|
||||
// Add shutdown hook to properly close HikariCP pool
|
||||
Runtime.getRuntime().addShutdownHook(
|
||||
Thread {
|
||||
logger.info { "Shutting down HikariCP connection pool..." }
|
||||
logger.debug { "Shutting down HikariCP connection pool..." }
|
||||
DBManager.shutdown()
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user