Loading now loads existing contexts as well

Loading now loads contexts created before manager created
Added additional trace logging
This commit is contained in:
Collin Smith
2020-08-28 21:33:25 -07:00
parent 6012bee436
commit 872f2e732e

View File

@ -1,6 +1,8 @@
package com.riiablo;
import android.support.annotation.NonNull;
import java.util.HashSet;
import java.util.Set;
import org.apache.commons.collections4.Trie;
import com.badlogic.gdx.Gdx;
@ -107,21 +109,35 @@ public class GdxLoggerManager {
}
public void saveAll() {
log.trace("Saving contexts...");
for (String context : logs.getContexts().keySet()) {
try {
save(context);
} catch (Throwable t) {
log.warn("Failed to save {}", context, t);
log.warn("Failed to save {}", getDebugName(context), t);
}
}
}
public void loadAll() {
log.trace("Loading existing contexts...");
Set<String> loaded = new HashSet<>();
for (String context : logs.getContexts().keySet()) {
try {
load(context);
loaded.add(context);
} catch (Throwable t) {
log.warn("Failed to load {}", getDebugName(context), t);
}
}
log.trace("Loading preferences...");
for (String context : PREFERENCES.get().keySet()) {
if (loaded.contains(context)) continue;
try {
load(context);
} catch (Throwable t) {
log.warn("Failed to load {}", context, t);
log.warn("Failed to load {}", getDebugName(context), t);
}
}
}