mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-30 07:07:22 +02:00
Fix bug with AbsLogger not initialized
This commit is contained in:
@@ -29,16 +29,16 @@ class AbsLogger : Plugin() {
|
|||||||
onLogEmitter = { log:AbsLog ->
|
onLogEmitter = { log:AbsLog ->
|
||||||
notifyListeners("onLog", JSObject(jacksonMapper.writeValueAsString(log)))
|
notifyListeners("onLog", JSObject(jacksonMapper.writeValueAsString(log)))
|
||||||
}
|
}
|
||||||
Log.i("AbsLogger", "Initialize AbsLogger plugin")
|
info("AbsLogger", "load: AbsLogger plugin initialized")
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
lateinit var onLogEmitter:(log:AbsLog) -> Unit
|
var onLogEmitter:((log:AbsLog) -> Unit)? = null
|
||||||
|
|
||||||
fun log(level:String, tag:String, message:String) {
|
fun log(level:String, tag:String, message:String) {
|
||||||
val absLog = AbsLog(id = UUID.randomUUID().toString(), tag, level, message, timestamp = System.currentTimeMillis())
|
val absLog = AbsLog(id = UUID.randomUUID().toString(), tag, level, message, timestamp = System.currentTimeMillis())
|
||||||
DeviceManager.dbManager.saveLog(absLog)
|
DeviceManager.dbManager.saveLog(absLog)
|
||||||
onLogEmitter(absLog)
|
onLogEmitter?.let { it(absLog) }
|
||||||
}
|
}
|
||||||
fun info(tag:String, message:String) {
|
fun info(tag:String, message:String) {
|
||||||
Log.i("AbsLogger", message)
|
Log.i("AbsLogger", message)
|
||||||
|
|||||||
Reference in New Issue
Block a user