236d864b | 18-Nov-2024 |
Amithash Prasasd <amithash@meta.com> |
Install commit.hpp into target include directory
This ensures that users can include commit.hpp which is needed to generate event logs
Change-Id: Ie04479d9a9ef41a3e3533db7bc20d33ff22b38be Signed-of
Install commit.hpp into target include directory
This ensures that users can include commit.hpp which is needed to generate event logs
Change-Id: Ie04479d9a9ef41a3e3533db7bc20d33ff22b38be Signed-off-by: Amithash Prasasd <amithash@meta.com>
show more ...
|
fc14867b | 06-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: commit: simplify commit functions
Eliminate the template indirection for the commit function in favor of a base-class overload. There was previously a public template specialization of `lg2::c
lg2: commit: simplify commit functions
Eliminate the template indirection for the commit function in favor of a base-class overload. There was previously a public template specialization of `lg2::commit` and a private base-class implementation (in the `details` namespace). The template implementations provided no stronger type-checking, since it was already a concept requiring inheritance from the base-class. The template precluded simple code such as:
```cpp try { //... } catch (const sdbusplus::exception::generated_event_base& e) { lg2::commit(e); } ```
By making the base-class types public, rather than hidden in the details namespace, and removing the templates, the code is simpler and more usable.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: If0a3e1331eff36aec4b9f7e4950636360d59306e
show more ...
|
6eb96bf7 | 05-Nov-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: commit: add support for journal-only method
The design document for the new event system references an option to log events to the journal rather than to dbus[1] using the 'OPENBMC_MESSAGE_ID'
lg2: commit: add support for journal-only method
The design document for the new event system references an option to log events to the journal rather than to dbus[1] using the 'OPENBMC_MESSAGE_ID' identifier. Add support and test cases for this as a meson option.
[1]: https://github.com/openbmc/docs/blob/master/designs/event-logging.md#phosphor-logging
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6cb94453c6cc95a9ccbbbc11859b70ef12d375fd
show more ...
|
9ca4d137 | 31-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
manager: use new Logging.Cleared event
Modify the internal manager support for creating internal events to be able to support the sdbusplus generated events. Transition from the local Logging.Error
manager: use new Logging.Cleared event
Modify the internal manager support for creating internal events to be able to support the sdbusplus generated events. Transition from the local Logging.Error.LogsCleared to the global Logging.Cleared event. Clean up references to the old event.
Tested: ``` $ busctl --user call xyz.openbmc_project.Logging /xyz/openbmc_project/logging xyz.openbmc_project.Collection.DeleteAll DeleteAll $ busctl --user introspect xyz.openbmc_project.Logging /xyz/openbmc_project/logging/entry/1 -l | cat NAME TYPE SIGNATURE RESULT/VALUE FLAGS xyz.openbmc_project.Logging.Entry interface - - - .GetEntry method - h - .AdditionalData property as 5 "NUMBER_OF_LOGS=210" "_CODE_FILE=../log_manager.hpp" "_CODE_FUNC=virtual void phosphor::logging::Manager::deleteAll()" "_CODE_LINE=361" "_PID=3318436" emits-change writable .EventId property s "" emits-change writable .Id property u 1 emits-change writable .Message property s "xyz.openbmc_project.Logging.Cleared" emits-change writable .Resolution property s "" emits-change writable .Resolved property b false emits-change writable .ServiceProviderNotify property s "xyz.openbmc_project.Logging.Entry.Notify.NotSupported" emits-change writable .Severity property s "xyz.openbmc_project.Logging.Entry.Level.Informational" emits-change writable .Timestamp property t 1730408674348 emits-change writable .UpdateTimestamp property t 1730408674348 emits-change writable ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I470f33ae2f5bfae6bf6d6a80ac2c5f028e41da95
show more ...
|
247fed60 | 31-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: commit: extract source location information and add to event
sdbusplus will add PID and std::source_location information, from the event origination point, to the event. Extract this and add i
lg2: commit: extract source location information and add to event
sdbusplus will add PID and std::source_location information, from the event origination point, to the event. Extract this and add it to the event.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6364ba0f74231fca2815c770bc3e56c2780d199e
show more ...
|
f0af358f | 10-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: commit: add methods for new sdbusplus events
Add implementations and test cases for the `lg2::commit` functions.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I25a87fd65738e4d
lg2: commit: add methods for new sdbusplus events
Add implementations and test cases for the `lg2::commit` functions.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I25a87fd65738e4debbe98f3473709f77d51777e9
show more ...
|
e001cd79 | 07-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: commit: add stubs to support new sdbusplus events
Create empty stubs for the commit functions from the new event log design[1].
[1]: https://github.com/openbmc/docs/blob/master/designs/event-l
lg2: commit: add stubs to support new sdbusplus events
Create empty stubs for the commit functions from the new event log design[1].
[1]: https://github.com/openbmc/docs/blob/master/designs/event-logging.md
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I8c0232858f41b875e78d5e41f17c065ca727429d
show more ...
|
4e1456e4 | 03-Oct-2024 |
Patrick Williams <patrick@stwcx.xyz> |
elog: ensure new sdbusplus events cannot be committed directly
sdbusplus events should not be committed in the old way, because they have their metadata directly in the class rather than using the s
elog: ensure new sdbusplus events cannot be committed directly
sdbusplus events should not be committed in the old way, because they have their metadata directly in the class rather than using the side-band metadata YAML (from phosphor-logging). Add compile-time asserts to ensure they cannot be used with the older interfaces.
Tested:
Create a simple test: ``` phosphor::logging::report< sdbusplus::event::xyz::openbmc_project::Logging::Cleared>(); ```
Which fails to compile as follows: ``` In file included from ../test/basic_event_commit.cpp:3: ../lib/include/phosphor-logging/elog.hpp: In instantiation of ‘uint32_t phosphor::logging::report(Args ...) [with T = sdbusplus::event::xyz::openbmc_project::Logging::Cleared; Args = {}; uint32_t = unsigned int]’: ../test/basic_event_commit.cpp:13:66: required from here ../lib/include/phosphor-logging/elog.hpp:205:15: error: static assertion failed: T must NOT be an sdbusplus::generated_event 205 | !std::is_base_of_v<sdbusplus::exception::generated_event<T>, T>, ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I9cfc6915d125545067082a4fff717443aedd1531
show more ...
|
7576224a | 03-Sep-2024 |
Patrick Williams <patrick@stwcx.xyz> |
meson: switch code dependency to libsystemd
For a while now systemd has packaged a separate `libsystemd`. For meson dependency, `systemd` should be used when looking for systemd service file paths
meson: switch code dependency to libsystemd
For a while now systemd has packaged a separate `libsystemd`. For meson dependency, `systemd` should be used when looking for systemd service file paths and `libsystemd` should be used for `sd_*` functions.
Update the dependency accordingly.
Change-Id: I2de6ab74c3384339a9f393d3149eabaccf1a5ba4 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
075c7923 | 16-Aug-2024 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we need to reformat the code with the latest version. The way clang-18 handles lambda forma
clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we need to reformat the code with the latest version. The way clang-18 handles lambda formatting also changed, so we have made changes to the organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style. See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: I21d2ca8065f24fd73509229c517f5caf48934b60 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
da063a9c | 13-Jul-2024 |
Patrick Williams <patrick@stwcx.xyz> |
Remove lg2 template deduction guides
Deduction guides for the base 'log' class are unnecessary and unused, and deduction guides for the level-types already exist. Remove the unused ones.
Signed-of
Remove lg2 template deduction guides
Deduction guides for the base 'log' class are unnecessary and unused, and deduction guides for the level-types already exist. Remove the unused ones.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I795ea3a6d453e7a101d9b1d257e1334c894e340b
show more ...
|
5bc26533 | 10-Apr-2024 |
Arya K Padman <aryakpadman@gmail.com> |
PEL: Changing the remaining traces to lg2 style
Some of the logging traces of PEL files still uses old style of logging.
Changing the remaining traces in PEL files to lg2 style of logging.Some of t
PEL: Changing the remaining traces to lg2 style
Some of the logging traces of PEL files still uses old style of logging.
Changing the remaining traces in PEL files to lg2 style of logging.Some of the traces in phosphor logging code which use the old style is also considered.
Change-Id: I0daf9589af443881cb61730047c23db17fdec2c3 Signed-off-by: Arya K Padman <aryakpadman@gmail.com>
show more ...
|
b6ed39fa | 26-Feb-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: allow enumeration formatting
A good amount of code is using something like `std::to_underlying` to convert enums to a value for output with lg2. Add support directly in the library.
Tested: M
lg2: allow enumeration formatting
A good amount of code is using something like `std::to_underlying` to convert enums to a value for output with lg2. Add support directly in the library.
Tested: Modified phosphor-health-monitor with one enum with a `to_string` conversion and one without: ``` <7> TYPE=CPU, NAME=CPU SUBTYPE=Enum(1) PATH=, FREQ=1, WSIZE=120 <7> TYPE=CPU, NAME=CPU_Kernel SUBTYPE=Enum(0) PATH=, FREQ=1, WSIZE=120 ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0644ff00fb7ff9b20daaf4ea5f9564b9b9e83237
show more ...
|
c2c32a2a | 26-Feb-2024 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: allow type output customizations
Allow lg2 output for custom types where the type has a `to_string` function defined per ADL lookup rules.
Tested: Modified phosphor-health-monitor to have a `t
lg2: allow type output customizations
Allow lg2 output for custom types where the type has a `to_string` function defined per ADL lookup rules.
Tested: Modified phosphor-health-monitor to have a `to_string` for local enumerations. ``` <7> TYPE=CPU, NAME=CPU SUBTYPE=CPU PATH=, FREQ=1, WSIZE=120 <7> TYPE=CPU, NAME=CPU_Kernel SUBTYPE=CPU_Kernel PATH=, FREQ=1, WSIZE=120 ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6850b0bb142f0ef5219a5fc07c2cb4e2c90d5779
show more ...
|
6ddbf69e | 05-Sep-2023 |
Willy Tu <wltu@google.com> |
Remove SDBUSPP_REMOVE_DEPRECATED_NAMESPACE
Fix the code to support new sdbusplus error without SDBUSPP_REMOVE_DEPRECATED_NAMESPACE.
Change-Id: I12713ec1757d3835e1acf07c7abf409ff97615e1 Signed-off-b
Remove SDBUSPP_REMOVE_DEPRECATED_NAMESPACE
Fix the code to support new sdbusplus error without SDBUSPP_REMOVE_DEPRECATED_NAMESPACE.
Change-Id: I12713ec1757d3835e1acf07c7abf409ff97615e1 Signed-off-by: Willy Tu <wltu@google.com>
show more ...
|
230f9f94 | 20-Jul-2023 |
Josh Lehan <krellan@google.com> |
lg2: Add mutex to avoid stderr line corruption
Use of a mutex, along with flushing after every line, prevents threads in multithreaded programs from corrupting each other's stderr logging lines. As
lg2: Add mutex to avoid stderr line corruption
Use of a mutex, along with flushing after every line, prevents threads in multithreaded programs from corrupting each other's stderr logging lines. As for the D-Bus journal messages, they are already atomic, not needing this fix.
Tested: The corruption appears fixed https://gist.github.com/Krellan/d5d9942cb5ab405c9689e4eb4bb75cf0
Change-Id: I1db88139406eb617aa713740d5ccb6c9420ca773 Signed-off-by: Josh Lehan <krellan@google.com>
show more ...
|
7f5e4410 | 23-Jun-2023 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: simplify source_location for clang-16
As of clang-16, `source_location` is fully supported, so we do not need to use the `experimental::source_location` workarounds anymore. Eliminate them and
lg2: simplify source_location for clang-16
As of clang-16, `source_location` is fully supported, so we do not need to use the `experimental::source_location` workarounds anymore. Eliminate them and use `std::source_location` directly rather than the `lg2::source_location` alias.
Tested: Compiled the repository with CXX=clang++.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Iba987ed9580d228781acac630681fda172a6cef7
show more ...
|
ac1ba3f2 | 10-May-2023 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require additional settings for best compatibility and re-running the formatter. Copy the latest
clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require additional settings for best compatibility and re-running the formatter. Copy the latest .clang-format from the docs repository and reformat the repository.
Change-Id: I077deb6e98025e4e8c6abd4d039f9af4db19342b Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
7691290f | 20-Dec-2022 |
George Liu <liuxiwei@inspur.com> |
lg2: Support sdbusplus::message::object_path type
Currently the sdbusplus::message::object_path type is not supported. To print the sdbusplus::message::object_path type, we need to explicitly obtain
lg2: Support sdbusplus::message::object_path type
Currently the sdbusplus::message::object_path type is not supported. To print the sdbusplus::message::object_path type, we need to explicitly obtain the string.
Resolves openbmc/phosphor-logging#25.
Without this patch: ``` sdbusplus::message::object_path objectPath; info("objectPath: {PATH}", "PATH", objectPath.str); ```
With this patch: ``` sdbusplus::message::object_path objectPath; info("objectPath: {PATH}", "PATH", objectPath); ```
Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ica2eb19554203af578b8368b4c63c0efc9835857
show more ...
|
c107f191 | 05-Oct-2022 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: minor tweak for readability
clang-format seems to have damaged the readability of one of the C++20 Concepts. Add parens to improve the readability.
Signed-off-by: Patrick Williams <patrick@st
lg2: minor tweak for readability
clang-format seems to have damaged the readability of one of the C++20 Concepts. Add parens to improve the readability.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0d9e591103bca0ec1d423559fffb4e2a972c3d61
show more ...
|
2544b419 | 04-Oct-2022 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: update with latest
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I329396457b83bb2eb8740629b4ac1fbe9106bced |
45e83521 | 22-Jul-2022 |
Patrick Williams <patrick@stwcx.xyz> |
sdbusplus: use shorter type aliases
The sdbusplus headers provide shortened aliases for many types. Switch to using them to provide better code clarity and shorter lines. Possible replacements are
sdbusplus: use shorter type aliases
The sdbusplus headers provide shortened aliases for many types. Switch to using them to provide better code clarity and shorter lines. Possible replacements are for: * bus_t * exception_t * manager_t * match_t * message_t * object_t * slot_t
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ibc25db433a6926f7ee43ea83312c3ac14f480c33
show more ...
|
ea06f8ec | 25-Mar-2022 |
Zane Shelley <zshelle@us.ibm.com> |
Enable lg2 log output to stderr in OpenBMC CI test
Similar to printing logs to stderr in a TTY, output to stderr can be enabled during OpenBMC CI test by setting the `LG2_FORCE_STDERR` environment v
Enable lg2 log output to stderr in OpenBMC CI test
Similar to printing logs to stderr in a TTY, output to stderr can be enabled during OpenBMC CI test by setting the `LG2_FORCE_STDERR` environment variable to any value.
Using meson, this can be done with something like:
test('test_name', executable(...), env: ['LG2_FORCE_STDERR=yes'])
Signed-off-by: Zane Shelley <zshelle@us.ibm.com> Change-Id: I0323fbb75fe211148ec4dc7e263fe18aabb8ffc6
show more ...
|
7460ce02 | 03-Mar-2022 |
Patrick Williams <patrick@stwcx.xyz> |
lg2: add experimental::source_location symbols on GCC
When we compile with a compiler that supports the C++20 source_location, we use that support and do not support the older experimental version.
lg2: add experimental::source_location symbols on GCC
When we compile with a compiler that supports the C++20 source_location, we use that support and do not support the older experimental version. Recent versions of GCC support it but Clang does not. This exposes an issue when attempting to link a GCC-compiled lg2 with a Clang-compiled application (missing symbol for experimental version).
Add a no-op symbol for experimental::source_location when the compiler supports std::source_location. This allows the Clang-compiled applications to successfully compile and link, but they will lose out on the lg2 functionality. The primary use-case of this is to compile with Clang in CI in order to get signal on the stricter warnings that Clang often has, so functionality is not necessary.
Tested:
Built with GCC and confirmed additional symbol for experimental::source_location support.
``` $ nm lib/libphosphor_logging.so.1.0.0 --defined-only -C | grep lg2::details::do_log 0000000000004520 T lg2::details::do_log(lg2::level, std::experimental::fundamentals_v2::source_location const&, char const*, ...) 0000000000004aa0 T lg2::details::do_log(lg2::level, std::source_location const&, char const*, ...) 0000000000003682 t lg2::details::do_log(lg2::level, std::source_location const&, char const*, ...) [clone .cold] ```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I4bc0b9f6619ce6088dfa44a3c18eb28d9080fb47
show more ...
|
31d78f77 | 07-Feb-2022 |
Stanley Chu <yschu@nuvoton.com> |
Fix wrong type of TRANSACTION_ID in journal metadata
In the log API, it prints message to systemd journal and also stores TRANSACTION_ID metadata with its value as %lld. However, the transaction id
Fix wrong type of TRANSACTION_ID in journal metadata
In the log API, it prints message to systemd journal and also stores TRANSACTION_ID metadata with its value as %lld. However, the transaction id is acquired from sdbusplus::server:: transaction::get_id(), which is a uint64_t. The type of TRANSACTION_ID metadata should be changed to %llu, otherwise phosphor::logging::internal::Manager::_commit() may not find the matched journal entry.
Signed-off-by: Stanley Chu <yschu@nuvoton.com> Change-Id: I2a70ae836ae33006a043569d2e3a692fcece7303
show more ...
|