add some logging

This commit is contained in:
Aria Moradi
2021-09-11 00:48:17 +04:30
parent 0a7aa48f1e
commit 1f9ea0891e
2 changed files with 2 additions and 0 deletions
@@ -71,6 +71,7 @@ object Extension {
suspend fun installExternalExtension(inputStream: InputStream, apkName: String): Int {
return installAPK {
val savePath = "${applicationDirs.extensionsRoot}/$apkName"
logger.debug { "Saving apk at $apkName" }
// download apk file
val downloadedFile = File(savePath)
downloadedFile.sink().buffer().use { sink ->
@@ -141,6 +141,7 @@ object PackageTools {
* It may return an instance of HttpSource or SourceFactory depending on the extension.
*/
fun loadExtensionSources(jarPath: String, className: String): Any {
logger.debug { "loading jar with path: $jarPath" }
val classLoader = URLClassLoader(arrayOf<URL>(URL("file:$jarPath")))
val classToLoad = Class.forName(className, false, classLoader)
return classToLoad.getDeclaredConstructor().newInstance()