Corrected and updated logging example (#1144)

Removed example using the + operator for string concatenation, since we should only be recommending parameterized logging. I also removed the string formatting example, since this could cause confusion when using Items with UoM.

Signed-off-by: Scott Rushworth <openhab@5iver.com>
pull/1145/head
Scott Rushworth 2020-01-20 13:20:43 -05:00 committed by Jerome Luckenbach
parent 77695884b6
commit b89c4a9319
1 changed files with 2 additions and 2 deletions

View File

@ -124,8 +124,8 @@ Examples for typical logging lines found in rules:
```text
logInfo("heating-control.rules", "Heating mode set to normal")
logError("heating-control.rules", "Heating control failed while in mode " + Heating_Mode.state)
logDebug("heating-control.rules", "Bedroom: Temperature: %1$.1f°C, Mode %2$s", Bedroom_Temp.state, Bedroom_Heater_Mode.state)
logWarn("heating-control.rules", "Heating control failed while in mode {}", Heating_Mode.state)
logDebug("heating-control.rules", "Bedroom: Temperature: {}, Mode: {}", Bedroom_Temp.state, Bedroom_Heater_Mode.state)
```
An example output of the last log statement above is: