This repository has been archived by the owner on Sep 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lazy trials, detector logic change, improve chat performance
- Loading branch information
Showing
57 changed files
with
438 additions
and
573 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@file:JvmName("Logging") | ||
|
||
package io.github.homchom.recode | ||
|
||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.cancel | ||
import org.slf4j.LoggerFactory | ||
import org.slf4j.event.Level | ||
|
||
private val logger = LoggerFactory.getLogger(MOD_ID).apply { isEnabledForLevel(Level.DEBUG) } | ||
|
||
fun logInfo(message: String) = logger.info("[$MOD_NAME] $message") | ||
|
||
@JvmOverloads | ||
fun logError(message: String, mentionBugReport: Boolean = false) { | ||
val bugString = if (mentionBugReport) { | ||
"\nIf you believe this is a bug, you can report it here: https://github.com/homchom/recode/issues)" | ||
} else "" | ||
logger.error("[$MOD_NAME] $message$bugString") | ||
} | ||
|
||
fun logDebug(message: String) = logDebug { message } | ||
|
||
inline fun logDebug(lazyMessage: () -> String) { | ||
if (debug) logInfo("[debug] ${lazyMessage()}") | ||
} | ||
|
||
/** | ||
* @see cancel | ||
* @see logDebug | ||
*/ | ||
fun CoroutineScope.cancelAndLog(message: String) { | ||
logDebug(message) | ||
cancel(message) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
883c1c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also removes
compute
andcomputeNullable