Improve logging

This commit is contained in:
Paul Schaub 2020-06-06 17:23:38 +02:00
parent c7a3b59a79
commit 892080fb02
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 6 additions and 4 deletions

View file

@ -85,7 +85,6 @@ public class LoginViewModel implements MercuryViewModel {
}
public synchronized void onLoginUsernameChanged(String username) {
LOGGER.log(Level.INFO, "USERNAME CHANGED: " + username);
if (StringUtils.isNullOrEmpty(username)) {
loginUsernameValue = null;
loginUsernameError.onNext(new Optional<>(UsernameError.emptyUsername));

View file

@ -58,7 +58,8 @@ public class MercuryConnection {
if (getConnection().isConnected()) {
return Completable.complete();
}
return Completable.fromAction(this::doConnect);
return Completable.fromAction(this::doConnect)
.doOnError(error -> LOGGER.log(Level.WARNING, "Connection error for account " + account, error));
}
private void doConnect() throws ServerUnreachableException {
@ -78,7 +79,8 @@ public class MercuryConnection {
if (getConnection().isAuthenticated()) {
return Completable.complete();
}
return Completable.fromAction(this::doLogin);
return Completable.fromAction(this::doLogin)
.doOnError(error -> LOGGER.log(Level.WARNING, "Login error for account " + account, error));
}
private void doLogin() throws InvalidCredentialsException {
@ -92,7 +94,8 @@ public class MercuryConnection {
}
public Completable shutdown() {
return Completable.fromAction(this::doShutdown);
return Completable.fromAction(this::doShutdown)
.doOnError(error -> LOGGER.log(Level.WARNING, "Shutdown error for account " + account, error));
}
public void doShutdown() {