Home
last modified time | relevance | path

Searched hist:dc35e3073a4395aee9fa04b9bc4b259bca539836 (Results 1 – 3 of 3) sorted by relevance

/openbmc/phosphor-logging/
H A Dlog_create_main.cppdc35e3073a4395aee9fa04b9bc4b259bca539836 Tue Nov 05 22:35:02 CST 2024 Patrick Williams <patrick@stwcx.xyz> log-create: add CLI utility to create events

Add utility to allow creation of events from the command line and
shell scripts. The utility ensures that the correct data arguments
are passed, or else fails the creation.

Tested:

```
$ ./builddir/log-create xyz.openbmc_project.Sensor.Threshold.SensorFailure --json '{ "SENSOR_NAME": "Example-Sensor" }'
<3> OPENBMC_MESSAGE_ID={"xyz.openbmc_project.Sensor.Threshold.SensorFailure":{"SENSOR_NAME":"Example-Sensor","_SOURCE":{"COLUMN":45,"FILE":"../log_create_main.cpp","FUNCTION":"int generate_event(const std::string&, const nlohmann::json_abi_v3_11_2::json&)","LINE":34,"PID":264326}}}
/xyz/openbmc_project/logging/entry/1

$ busctl --user introspect xyz.openbmc_project.Logging /xyz/openbmc_project/logging/entry/1 -l | cat
xyz.openbmc_project.Logging.Entry interface - - -
.AdditionalData property as 5 "SENSOR_NAME=\"Example-Sensor\"" "_CODE_FILE=../log_create_main.cpp" "_CODE_FUNC=int generate_event(const std::string&, const nlohmann::json_abi_v3_11_2::json&)" "_CODE_LINE=34" "_PID=264326" emits-change writable
.Id property u 1 emits-change writable
.Message property s "xyz.openbmc_project.Sensor.Threshold.SensorFailure" emits-change writable
.Severity property s "xyz.openbmc_project.Logging.Entry.Level.Critical" emits-change writable

$ ./builddir/log-create xyz.openbmc_project.Sensor.Threshold.SensorFailure
terminate called after throwing an instance of 'nlohmann::json_abi_v3_11_2::detail::out_of_range'
what(): [json.exception.out_of_range.403] key 'SENSOR_NAME' not found

$ ./builddir/log-create xyz.openbmc_project.Invalid.Event.Name
Unknown event: xyz.openbmc_project.Invalid.Event.Name
```

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I357b453f8fecc9d224aa412ad7f3cc6b8c2a4ad8
H A Dmeson.builddiff dc35e3073a4395aee9fa04b9bc4b259bca539836 Tue Nov 05 22:35:02 CST 2024 Patrick Williams <patrick@stwcx.xyz> log-create: add CLI utility to create events

Add utility to allow creation of events from the command line and
shell scripts. The utility ensures that the correct data arguments
are passed, or else fails the creation.

Tested:

```
$ ./builddir/log-create xyz.openbmc_project.Sensor.Threshold.SensorFailure --json '{ "SENSOR_NAME": "Example-Sensor" }'
<3> OPENBMC_MESSAGE_ID={"xyz.openbmc_project.Sensor.Threshold.SensorFailure":{"SENSOR_NAME":"Example-Sensor","_SOURCE":{"COLUMN":45,"FILE":"../log_create_main.cpp","FUNCTION":"int generate_event(const std::string&, const nlohmann::json_abi_v3_11_2::json&)","LINE":34,"PID":264326}}}
/xyz/openbmc_project/logging/entry/1

$ busctl --user introspect xyz.openbmc_project.Logging /xyz/openbmc_project/logging/entry/1 -l | cat
xyz.openbmc_project.Logging.Entry interface - - -
.AdditionalData property as 5 "SENSOR_NAME=\"Example-Sensor\"" "_CODE_FILE=../log_create_main.cpp" "_CODE_FUNC=int generate_event(const std::string&, const nlohmann::json_abi_v3_11_2::json&)" "_CODE_LINE=34" "_PID=264326" emits-change writable
.Id property u 1 emits-change writable
.Message property s "xyz.openbmc_project.Sensor.Threshold.SensorFailure" emits-change writable
.Severity property s "xyz.openbmc_project.Logging.Entry.Level.Critical" emits-change writable

$ ./builddir/log-create xyz.openbmc_project.Sensor.Threshold.SensorFailure
terminate called after throwing an instance of 'nlohmann::json_abi_v3_11_2::detail::out_of_range'
what(): [json.exception.out_of_range.403] key 'SENSOR_NAME' not found

$ ./builddir/log-create xyz.openbmc_project.Invalid.Event.Name
Unknown event: xyz.openbmc_project.Invalid.Event.Name
```

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I357b453f8fecc9d224aa412ad7f3cc6b8c2a4ad8
/openbmc/phosphor-logging/extensions/openpower-pels/
H A Dmeson.builddiff dc35e3073a4395aee9fa04b9bc4b259bca539836 Tue Nov 05 22:35:02 CST 2024 Patrick Williams <patrick@stwcx.xyz> log-create: add CLI utility to create events

Add utility to allow creation of events from the command line and
shell scripts. The utility ensures that the correct data arguments
are passed, or else fails the creation.

Tested:

```
$ ./builddir/log-create xyz.openbmc_project.Sensor.Threshold.SensorFailure --json '{ "SENSOR_NAME": "Example-Sensor" }'
<3> OPENBMC_MESSAGE_ID={"xyz.openbmc_project.Sensor.Threshold.SensorFailure":{"SENSOR_NAME":"Example-Sensor","_SOURCE":{"COLUMN":45,"FILE":"../log_create_main.cpp","FUNCTION":"int generate_event(const std::string&, const nlohmann::json_abi_v3_11_2::json&)","LINE":34,"PID":264326}}}
/xyz/openbmc_project/logging/entry/1

$ busctl --user introspect xyz.openbmc_project.Logging /xyz/openbmc_project/logging/entry/1 -l | cat
xyz.openbmc_project.Logging.Entry interface - - -
.AdditionalData property as 5 "SENSOR_NAME=\"Example-Sensor\"" "_CODE_FILE=../log_create_main.cpp" "_CODE_FUNC=int generate_event(const std::string&, const nlohmann::json_abi_v3_11_2::json&)" "_CODE_LINE=34" "_PID=264326" emits-change writable
.Id property u 1 emits-change writable
.Message property s "xyz.openbmc_project.Sensor.Threshold.SensorFailure" emits-change writable
.Severity property s "xyz.openbmc_project.Logging.Entry.Level.Critical" emits-change writable

$ ./builddir/log-create xyz.openbmc_project.Sensor.Threshold.SensorFailure
terminate called after throwing an instance of 'nlohmann::json_abi_v3_11_2::detail::out_of_range'
what(): [json.exception.out_of_range.403] key 'SENSOR_NAME' not found

$ ./builddir/log-create xyz.openbmc_project.Invalid.Event.Name
Unknown event: xyz.openbmc_project.Invalid.Event.Name
```

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I357b453f8fecc9d224aa412ad7f3cc6b8c2a4ad8