logging: replace direct journal calls with lg2

Tested:

Created a bogus journal message equivalent to the one in
TachSensor.hpp as the first line of 'main' in FanMain.cpp:

```
    auto device = "FooBar";
    auto msg = "OpenBMC.0.1.FanInserted";
    lg2::error("Fan Inserted", "REDFISH_MESSAGE_ID", msg,
               "REDFISH_MESSAGE_ARGS", device);
```

Observed the following in the journal:
```
{
	"_MACHINE_ID" : "115e76f3bc47411eb0f20075b13444e9",
	"_CMDLINE" : "/usr/bin/fansensor",
	"REDFISH_MESSAGE_ID" : "OpenBMC.0.1.FanInserted",
	"CODE_LINE" : "463",
	"_COMM" : "fansensor",
	"_EXE" : "/usr/bin/fansensor",
	"_SOURCE_REALTIME_TIMESTAMP" : "33256618",
	"__MONOTONIC_TIMESTAMP" : "33256849",
	"SYSLOG_IDENTIFIER" : "fansensor",
	"PRIORITY" : "3",
	"_CAP_EFFECTIVE" : "1ffffffffff",
	"_PID" : "296",
	"_UID" : "0",
	"_SYSTEMD_UNIT" : "xyz.openbmc_project.fansensor.service",
	"REDFISH_MESSAGE_ARGS" : "FooBar",
	"__REALTIME_TIMESTAMP" : "33256822",
	"LOG2_FMTMSG" : "Fan Inserted",
	"_SYSTEMD_CGROUP" : "/system.slice/xyz.openbmc_project.fansensor.service",
	"_GID" : "0",
	"_TRANSPORT" : "journal",
	"__CURSOR" : "s=039afc05fc934fe08b77dd73c4092591;i=1ff;b=5ad25f16b9bd424ebe72cf30558fcdc2;m=1fb7591;t=1fb7576;x=617adeeaf1da9edc",
	"CODE_FILE" : "../../../../../../../../sync/openbmc-sources/dbus-sensors/src/FanMain.cpp",
	"_SYSTEMD_INVOCATION_ID" : "9eef21c4b7784ba2aa2628f162079cd3",
	"CODE_FUNC" : "int main()",
	"MESSAGE" : "Fan Inserted",
	"_HOSTNAME" : "bletchley",
	"_SYSTEMD_SLICE" : "system.slice",
	"_BOOT_ID" : "5ad25f16b9bd424ebe72cf30558fcdc2"
}
```

Observed the following in /var/log/redfish:
```
1970-01-01T00:00:27.345477+00:00 OpenBMC.0.1.FanInserted,FooBar
```

Observed the following in Redfish:
```
{
      "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/27",
      "@odata.type": "#LogEntry.v1_4_0.LogEntry",
      "Created": "1970-01-01T00:00:27+00:00",
      "EntryType": "Event",
      "Id": "27",
      "Message": "FooBar inserted.",
      "MessageArgs": [
        "FooBar"
      ],
      "MessageId": "OpenBMC.0.1.FanInserted",
      "Name": "System Event Log Entry",
      "Severity": "OK"
    }
```

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib408e97ff99863cd91bcbcb43a4738d773f4e21c
4 files changed
tree: dd94c8e7f24c7d0669817075896da92ea420430c
  1. include/
  2. service_files/
  3. src/
  4. subprojects/
  5. tests/
  6. .clang-format
  7. .clang-ignore
  8. .clang-tidy
  9. .gitignore
  10. Jenkinsfile
  11. LICENSE
  12. MAINTAINERS
  13. meson.build
  14. meson_options.txt
  15. OWNERS
  16. README.md
README.md

dbus-sensors

dbus-sensors is a collection of sensor applications that provide the xyz.openbmc_project.Sensor collection of interfaces. They read sensor values from hwmon, d-bus, or direct driver access to provide readings. Some advance non-sensor features such as fan presence, pwm control, and automatic cpu detection (x86) are also supported.

key features

  • runtime re-configurable from d-bus (entity-manager or the like)

  • isolated: each sensor type is isolated into its own daemon, so a bug in one sensor is unlikely to affect another, and single sensor modifications are possible

  • async single-threaded: uses sdbusplus/asio bindings

  • multiple data inputs: hwmon, d-bus, direct driver access

sensor documentation