1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 14:11:15 +02:00

libflashrom: Add set log level functionality

Before this commit, any message from Flashrom would trigger
the user's callback. This could lead to additional delays
and slow down overall Flashrom performance.

This patch adds the ability to configure the log level for
messages from Flashrom. It sets the default log level to INFO

Testing: Both unit tests and CLI tools serve as libflashrom clients.
    All unit tests run successfully.

Change-Id: I095d48b8feb5fbc950a36eb17bed0d7cb8d9df64
Signed-off-by: Dmitry Zhadinets <dzhadinets@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/87047
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Dmitry Zhadinets
2025-03-29 19:10:24 -04:00
committed by Anastasia Klimchuk
parent b1794138f0
commit 6571f263b5
5 changed files with 65 additions and 11 deletions

View File

@ -57,6 +57,20 @@ enum flashrom_log_level {
FLASHROM_MSG_SPEW = 5,
};
typedef int(flashrom_log_callback)(enum flashrom_log_level, const char *format, va_list);
/**
* @brief Set the log level.
*
* Set a log level for messages from libflashrom.
* The print callback will be invoked only for messages
* with a log level less than or equal to the configured value.
* The default log level is FLASHROM_MSG_INFO.
*
* @param level The log level to be set.
*/
void flashrom_set_log_level(enum flashrom_log_level level);
/**
* @brief Set the log callback function.
*