| #pragma once | |
| #include "boottime_api/boottime_api.h" | |
| #include <fmt/printf.h> | |
| namespace boot_time_monitor | |
| { | |
| namespace log | |
| { | |
| /** | |
| * @brief Logs an error message to stderr if the given status is not OK. | |
| * | |
| * This is a utility function that checks an `absl::Status` object. If the | |
| * status represents an error condition (`!status.ok()`), the function | |
| * prints the detailed error string to the standard error stream. | |
| * | |
| * @param status The `absl::Status` to check. | |
| */ | |
| inline void LogIfError(const absl::Status& status) | |
| { | |
| if (!status.ok()) | |
| { | |
| fmt::print(stderr, "{}\n", status.ToString()); | |
| } | |
| } | |
| } // namespace log | |
| } // namespace boot_time_monitor |