Improve logging for login/account creation

pull/131/head
Tom Hacohen 4 years ago
parent 2b88ad6896
commit bf1acb1ff5

@ -70,10 +70,10 @@ class BaseConfigurationFinder(protected val context: Context, protected val cred
val userInfoManager = UserInfoManager(authenticatedHttpClient, uri.toHttpUrlOrNull()!!)
userInfo = userInfoManager.fetch(credentials.userName)
} catch (e: Exceptions.HttpException) {
Logger.log.warning(e.message)
Logger.log.warning(e.localizedMessage)
exception = e
} catch (e: IOException) {
Logger.log.warning(e.message)
Logger.log.warning(e.localizedMessage)
exception = e
}
@ -98,6 +98,7 @@ class BaseConfigurationFinder(protected val context: Context, protected val cred
val etebase = Account.login(client, credentials.userName, credentials.password)
etebaseSession = etebase.save(null)
} catch (e: EtebaseException) {
Logger.log.warning(e.localizedMessage)
exception = e
}
@ -114,8 +115,10 @@ class BaseConfigurationFinder(protected val context: Context, protected val cred
fun findInitialConfiguration(): Configuration {
try {
if (isServerEtebase()) {
Logger.log.fine("Attempting to login to etebase")
return findInitialConfigurationEtebase()
} else {
Logger.log.fine("Attempting to login to EteSync legacy")
return findInitialConfigurationLegacy()
}
} catch (e: Exception) {

@ -39,6 +39,7 @@ class DetectConfigurationFragment : DialogFragment(), LoaderManager.LoaderCallba
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Logger.log.fine("DetectConfigurationFragment: loading")
loaderManager.initLoader(0, arguments, this)
}
@ -49,17 +50,20 @@ class DetectConfigurationFragment : DialogFragment(), LoaderManager.LoaderCallba
override fun onLoadFinished(loader: Loader<Configuration>, data: Configuration?) {
if (data != null) {
if (data.isFailed) {
Logger.log.warning("Failed login configuration ${data.error?.localizedMessage}")
// no service found: show error message
requireFragmentManager().beginTransaction()
.add(NothingDetectedFragment.newInstance(data.error!!.localizedMessage), null)
.commitAllowingStateLoss()
} else if (data.isLegacy) {
// legacy service found: continue
Logger.log.info("Found legacy account - asking for encryption details")
requireFragmentManager().beginTransaction()
.replace(android.R.id.content, EncryptionDetailsFragment.newInstance(data))
.addToBackStack(null)
.commitAllowingStateLoss()
} else {
Logger.log.info("Found Etebase account account")
requireFragmentManager().beginTransaction()
.replace(android.R.id.content, CreateAccountFragment.newInstance(data))
.addToBackStack(null)

Loading…
Cancel
Save