SharedPreferenceに保存するように WIP

This commit is contained in:
ろむねこ 2024-06-12 14:58:56 +09:00
parent bcf3503868
commit b9080f5c94
Signed by: Fujimatsu
GPG Key ID: FA1F39A1BA37D168

View File

@ -10,18 +10,21 @@ import java.util.List;
import javax.inject.Inject;
import one.nem.kidshift.utils.KSLogger;
import one.nem.kidshift.utils.SharedPrefUtils;
import one.nem.kidshift.utils.enums.LogLevelEnum;
import one.nem.kidshift.utils.factory.SharedPrefUtilsFactory;
import one.nem.kidshift.utils.models.LogModel;
public class KSLoggerImpl implements KSLogger {
private ArrayList<LogModel> logs = new ArrayList<LogModel>();
private ArrayList<String> tags = new ArrayList<String>();
private SharedPrefUtils sharedPrefUtils;
@Inject
public KSLoggerImpl() {
public KSLoggerImpl(SharedPrefUtilsFactory sharedPrefUtilsFactory) {
tags.add("UNTAGGED");
this.sharedPrefUtils = sharedPrefUtilsFactory.create("KSLogger");
}
public KSLoggerImpl(String tag) {
@ -54,7 +57,7 @@ public class KSLoggerImpl implements KSLogger {
@Override
public List<LogModel> getHistory() {
return logs;
return null; // WIP
}
@Override
@ -93,7 +96,7 @@ public class KSLoggerImpl implements KSLogger {
}
private void addLog(LogModel log) {
logs.add(log);
sharedPrefUtils.saveObject(log);
}
private void outputLog(LogModel log) {