Remove redundancies in UserEntryLogger
This commit is contained in:
parent
bb147deb92
commit
0b00f4b401
1 changed files with 3 additions and 49 deletions
|
@ -26,64 +26,18 @@ class UserEntryLogger @Inject constructor(
|
||||||
fun log(action: Action, s: String? ="", vararg listvalues: ValueWithUnit) {
|
fun log(action: Action, s: String? ="", vararg listvalues: ValueWithUnit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun log(action: Action, source: Sources, note: String? ="", vararg listvalues: XXXValueWithUnit?) {
|
|
||||||
val filteredValues = listvalues.toList().filter { it != null}
|
|
||||||
compositeDisposable += repository.runTransaction(UserEntryTransaction(
|
|
||||||
action = action,
|
|
||||||
source = source,
|
|
||||||
note = note ?:"",
|
|
||||||
values = filteredValues
|
|
||||||
))
|
|
||||||
.subscribeOn(aapsSchedulers.io)
|
|
||||||
.observeOn(aapsSchedulers.io)
|
|
||||||
.subscribeBy(
|
|
||||||
onError = { aapsLogger.debug("ERRORED USER ENTRY: $action $source $note $filteredValues") },
|
|
||||||
onComplete = { aapsLogger.debug("USER ENTRY: $action $source $note $filteredValues") }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated("Use XXXValueWithUnits")
|
@Deprecated("Use XXXValueWithUnits")
|
||||||
fun log(action: Action, vararg listValues: ValueWithUnit) {
|
fun log(action: Action, vararg listValues: ValueWithUnit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun log(action: Action, source: Sources, vararg listvalues: XXXValueWithUnit?) {
|
|
||||||
val filteredValues = listvalues.toList().filter { it != null}
|
|
||||||
compositeDisposable += repository.runTransaction(UserEntryTransaction(
|
|
||||||
action = action,
|
|
||||||
source = source,
|
|
||||||
note = "",
|
|
||||||
values = filteredValues
|
|
||||||
))
|
|
||||||
.subscribeOn(aapsSchedulers.io)
|
|
||||||
.observeOn(aapsSchedulers.io)
|
|
||||||
.subscribeBy(
|
|
||||||
onError = { aapsLogger.debug("ERRORED USER ENTRY: $action $source $filteredValues") },
|
|
||||||
onComplete = { aapsLogger.debug("USER ENTRY: $action $source $filteredValues") }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated("Use XXXValueWithUnits")
|
@Deprecated("Use XXXValueWithUnits")
|
||||||
fun log(action: Action, s: String? = "") {}
|
fun log(action: Action, s: String? = "") {}
|
||||||
|
|
||||||
fun log(action: Action, source: Sources, note: String? ="") {
|
fun log(action: Action, source: Sources, note: String? ="", vararg listvalues: XXXValueWithUnit?) = log(action, source, note, listvalues.toList())
|
||||||
compositeDisposable += repository.runTransaction(UserEntryTransaction(
|
|
||||||
action = action,
|
|
||||||
source = source,
|
|
||||||
note = note ?:"",
|
|
||||||
values = listOf()
|
|
||||||
))
|
|
||||||
.subscribeOn(aapsSchedulers.io)
|
|
||||||
.observeOn(aapsSchedulers.io)
|
|
||||||
.subscribeBy(
|
|
||||||
onError = { aapsLogger.debug("ERRORED USER ENTRY: $action $source $note") },
|
|
||||||
onComplete = { aapsLogger.debug("USER ENTRY: $action $source $note") }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated("Use XXXValueWithUnits")
|
fun log(action: Action, source: Sources, vararg listvalues: XXXValueWithUnit?) = log(action, source,"", listvalues.toList())
|
||||||
fun log(action: Action, s: String? = "", values: MutableList<ValueWithUnit>) {}
|
|
||||||
|
|
||||||
fun log(action: Action, source: Sources, note: String? ="", listvalues: MutableList<XXXValueWithUnit?>) {
|
fun log(action: Action, source: Sources, note: String? ="", listvalues: List<XXXValueWithUnit?> = listOf()) {
|
||||||
val filteredValues = listvalues.toList().filter { it != null}
|
val filteredValues = listvalues.toList().filter { it != null}
|
||||||
compositeDisposable += repository.runTransaction(UserEntryTransaction(
|
compositeDisposable += repository.runTransaction(UserEntryTransaction(
|
||||||
action = action,
|
action = action,
|
||||||
|
|
Loading…
Reference in a new issue