diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/kotlin/App.kt | 6 | ||||
-rw-r--r-- | src/main/kotlin/DatabaseController.kt | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/main/kotlin/App.kt b/src/main/kotlin/App.kt index 0c586e0..f080357 100644 --- a/src/main/kotlin/App.kt +++ b/src/main/kotlin/App.kt @@ -3,6 +3,7 @@ package space.anity import com.fizzed.rocker.* import com.fizzed.rocker.runtime.* import io.javalin.* +import io.javalin.Handler import io.javalin.apibuilder.ApiBuilder.* import io.javalin.core.util.* import io.javalin.rendering.* @@ -11,9 +12,11 @@ import io.javalin.security.* import io.javalin.security.SecurityUtil.roles import java.io.* import java.nio.file.* +import java.util.logging.* const val fileHome = "files" val databaseController = DatabaseController() +val LOG = Logger.getLogger("App.kt") fun main() { val app = Javalin.create() @@ -81,7 +84,8 @@ fun crawlFiles(ctx: Context) { "content", Files.readAllLines( Paths.get("$fileHome/${ctx.splats()[0]}"), Charsets.UTF_8 - ).toString() + ).toString(), + "filename", File("$fileHome/${ctx.splats()[0]}").name ) ) } catch (_: java.nio.file.NoSuchFileException) { diff --git a/src/main/kotlin/DatabaseController.kt b/src/main/kotlin/DatabaseController.kt index 64acc6c..32e33ef 100644 --- a/src/main/kotlin/DatabaseController.kt +++ b/src/main/kotlin/DatabaseController.kt @@ -3,9 +3,11 @@ package space.anity import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.transactions.* import java.sql.* +import java.util.logging.* class DatabaseController(dbFileLocation: String = "main.db") { val db: Database + val LOG = Logger.getLogger(this.javaClass.name) /** * Database table for the file location indexing @@ -53,7 +55,7 @@ class DatabaseController(dbFileLocation: String = "main.db") { it[role] = roleString } } catch (_: org.jetbrains.exposed.exceptions.ExposedSQLException) { - println("User already exists") + LOG.warning("User already exists!") } } |