Skip to content

Commit 558cd49

Browse files
committed
posix: getopt: use configurable log level
Use the logging Kconfig template to facilitate a configurable log level for getopt() and friends. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
1 parent b1e87fc commit 558cd49

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lib/posix/c_lib_ext/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ config GETOPT_LONG
2626
for other threads by extending function getopt_state_get in
2727
getopt_common.c file.
2828

29+
module = GETOPT
30+
module-str = getopt
31+
source "subsys/logging/Kconfig.template.log_config"
32+
2933
endif # POSIX_C_LIB_EXT

lib/posix/c_lib_ext/getopt/getopt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include "getopt_common.h"
4040

4141
#include <zephyr/logging/log.h>
42-
LOG_MODULE_REGISTER(getopt);
42+
LOG_MODULE_REGISTER(getopt, CONFIG_GETOPT_LOG_LEVEL);
4343

4444
#define BADCH ((int)'?')
4545
#define BADARG ((int)':')

lib/posix/c_lib_ext/getopt/getopt_long.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#include "getopt_common.h"
5555

5656
#include <zephyr/logging/log.h>
57-
LOG_MODULE_DECLARE(getopt);
57+
LOG_MODULE_DECLARE(getopt, CONFIG_GETOPT_LOG_LEVEL);
5858

5959
#define GNU_COMPATIBLE /* Be more compatible, configure's use us! */
6060

0 commit comments

Comments
 (0)