Skip to content
Snippets Groups Projects
Commit 8b8c835e authored by Sebastian's avatar Sebastian Committed by Mikolai Gütschow
Browse files

Replace some println and slf4j logging with java.util.logging

parent 55f02d80
No related branches found
No related tags found
1 merge request!22Make it possible to start briar with temporary account with a bunch of testing contacts
......@@ -22,6 +22,7 @@ import org.briarproject.briar.desktop.dialogs.Registration
import org.briarproject.briar.desktop.paul.theme.BriarTheme
import org.briarproject.briar.desktop.paul.views.BriarUIStateManager
import java.awt.Dimension
import java.util.logging.Logger
import javax.annotation.concurrent.Immutable
import javax.inject.Inject
import javax.inject.Singleton
......@@ -62,6 +63,10 @@ constructor(
private val passwordStrengthEstimator: PasswordStrengthEstimator
) : BriarService {
companion object {
private val LOG = Logger.getLogger(BriarServiceImpl::class.java.name)
}
private val contacts: MutableList<Contact> = ArrayList()
override fun stop() {
......@@ -145,7 +150,7 @@ constructor(
private fun loadContacts() {
val contacts = contactManager.contacts
for (contact in contacts) {
println("${contact.author.name} (${contact.alias})")
LOG.info("loaded contact: ${contact.author.name} (${contact.alias})")
this.contacts.add(contact)
}
}
......
package org.briarproject.briar.desktop.chat
import org.briarproject.bramble.api.db.DbException
import org.briarproject.bramble.util.LogUtils
import org.briarproject.briar.api.blog.BlogInvitationRequest
import org.briarproject.briar.api.blog.BlogInvitationResponse
import org.briarproject.briar.api.conversation.ConversationMessageHeader
......@@ -13,7 +14,8 @@ import org.briarproject.briar.api.messaging.MessagingManager
import org.briarproject.briar.api.messaging.PrivateMessageHeader
import org.briarproject.briar.api.privategroup.invitation.GroupInvitationRequest
import org.briarproject.briar.api.privategroup.invitation.GroupInvitationResponse
import org.slf4j.LoggerFactory
import java.util.logging.Level.WARNING
import java.util.logging.Logger
class ChatHistoryConversationVisitor(
private val chat: Chat,
......@@ -22,7 +24,7 @@ class ChatHistoryConversationVisitor(
ConversationMessageVisitor<Void?> {
companion object {
val logger = LoggerFactory.getLogger(ChatHistoryConversationVisitor::class.java)
private val LOG = Logger.getLogger(ChatHistoryConversationVisitor::class.java.name)
}
fun appendMessage(header: ConversationMessageHeader) {
......@@ -30,7 +32,8 @@ class ChatHistoryConversationVisitor(
val messageText = messagingManager.getMessageText(header.id)
chat.appendMessage(header.isLocal, header.timestamp, messageText)
} catch (e: DbException) {
logger.warn("Error while getting message text", e)
LOG.warning("Error while getting message text")
LogUtils.logException(LOG, WARNING, e)
}
}
......
......@@ -9,16 +9,21 @@ import java.nio.file.Files
import java.nio.file.Path
import java.util.logging.Level.INFO
import java.util.logging.LogManager
import java.util.logging.Logger
import kotlin.io.path.absolute
internal class RunWithTemporaryAccount(val customization: BriarDesktopTestApp.() -> Unit) {
companion object {
private val LOG = Logger.getLogger(RunWithTemporaryAccount::class.java.name)
}
@OptIn(ExperimentalComposeUiApi::class)
fun run() = application {
LogManager.getLogManager().getLogger("").level = INFO
val dataDir = getDataDir()
println("Using data directory '$dataDir'")
LOG.info("Using data directory '$dataDir'")
val app =
DaggerBriarDesktopTestApp.builder().desktopTestModule(
......@@ -26,7 +31,7 @@ internal class RunWithTemporaryAccount(val customization: BriarDesktopTestApp.()
).build()
app.getShutdownManager().addShutdownHook {
println("deleting temporary account at $dataDir")
LOG.info("deleting temporary account at $dataDir")
org.apache.commons.io.FileUtils.deleteDirectory(dataDir.toFile())
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment