fix logging tags

This commit is contained in:
Andrei Vereha 2021-12-06 20:21:46 +01:00
parent e41fdfdd4b
commit a43beccdda

View file

@ -394,7 +394,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
if (activeCommand == null) {
Completable.complete()
} else {
logger.warn(LTag.PUMP, "Active command already existing: $activeCommand")
logger.warn(LTag.PUMPCOMM, "Active command already existing: $activeCommand")
Completable.error(
java.lang.IllegalStateException(
"Trying to send a command " +
@ -432,7 +432,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
override fun updateActiveCommand() = Maybe.create<CommandConfirmed> { source ->
val activeCommand = podState.activeCommand
if (activeCommand == null) {
logger.error("No active command to update")
logger.error(LTag.PUMPCOMM, "No active command to update")
source.onComplete()
return@create
}
@ -502,6 +502,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
override fun getCommandConfirmationFromState(): CommandConfirmationFromState {
return podState.activeCommand?.run {
logger.debug(
LTag.PUMPCOMM,
"Getting command state with parameters: $activeCommand " +
"lastResponse=$lastStatusResponseReceived " +
"$sequenceNumberOfLastProgrammingCommand $historyId"
@ -634,7 +635,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
override fun updateFromAlarmStatusResponse(response: AlarmStatusResponse) {
logger.info(
LTag.PUMP,
LTag.PUMPCOMM,
"Received AlarmStatusResponse: $response"
)
podState.deliveryStatus = response.deliveryStatus
@ -678,12 +679,12 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
private fun store() {
try {
val cleanPodState = podState.copy(ltk = byteArrayOf()) // do not log ltk
logger.debug(LTag.PUMP, "Storing Pod state: ${Gson().toJson(cleanPodState)}")
logger.debug(LTag.PUMPCOMM, "Storing Pod state: ${Gson().toJson(cleanPodState)}")
val serialized = Gson().toJson(podState)
sharedPreferences.putString(R.string.key_omnipod_dash_pod_state, serialized)
} catch (ex: Exception) {
logger.error(LTag.PUMP, "Failed to store Pod state", ex)
logger.error(LTag.PUMPCOMM, "Failed to store Pod state", ex)
}
}
@ -695,7 +696,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
PodState::class.java
)
} catch (ex: Exception) {
logger.error(LTag.PUMP, "Failed to deserialize Pod state", ex)
logger.error(LTag.PUMPCOMM, "Failed to deserialize Pod state", ex)
}
}
return PodState()