|
| 1 | +From 4603d09f5d1bd9ca0a1d4467d30a71528c8e2df4 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Joachim Wiberg < [email protected]> |
| 3 | +Date: Mon, 1 Sep 2025 14:24:03 +0200 |
| 4 | +Subject: [PATCH] lyd_validate_obsolete: change log level warning -> debug |
| 5 | +MIME-Version: 1.0 |
| 6 | +Content-Type: text/plain; charset=UTF-8 |
| 7 | +Content-Transfer-Encoding: 8bit |
| 8 | +Organization: Wires |
| 9 | + |
| 10 | +A library should not log directly to syslog, this is the responsibility |
| 11 | +of the application. In our case sysrepo, with a knob to disable it when |
| 12 | +you know what you're doing or have other ways of handling deprecated and |
| 13 | +obsolete nodes — e.g., automatically migrating them to a new tree. |
| 14 | + |
| 15 | +Signed-off-by: Joachim Wiberg < [email protected]> |
| 16 | +--- |
| 17 | + src/log.c | 3 +++ |
| 18 | + src/log.h | 1 + |
| 19 | + src/validation.c | 2 +- |
| 20 | + 3 files changed, 5 insertions(+), 1 deletion(-) |
| 21 | + |
| 22 | +diff --git a/src/log.c b/src/log.c |
| 23 | +index 13da500ef..553aefe55 100644 |
| 24 | +--- a/src/log.c |
| 25 | ++++ b/src/log.c |
| 26 | +@@ -705,6 +705,9 @@ ly_log_dbg(uint32_t group, const char *format, ...) |
| 27 | + case LY_LDGDEPSETS: |
| 28 | + str_group = "DEPSETS"; |
| 29 | + break; |
| 30 | ++ case LY_LDGSCHEMA: |
| 31 | ++ str_group = "SCHEMA"; |
| 32 | ++ break; |
| 33 | + default: |
| 34 | + LOGINT(NULL); |
| 35 | + return; |
| 36 | +diff --git a/src/log.h b/src/log.h |
| 37 | +index 85f2ac6d4..2bbb0b19b 100644 |
| 38 | +--- a/src/log.h |
| 39 | ++++ b/src/log.h |
| 40 | +@@ -156,6 +156,7 @@ LIBYANG_API_DECL uint32_t *ly_temp_log_options(uint32_t *opts); |
| 41 | + #define LY_LDGDICT 0x01 /**< Dictionary additions and deletions. */ |
| 42 | + #define LY_LDGXPATH 0x02 /**< XPath parsing end evaluation. */ |
| 43 | + #define LY_LDGDEPSETS 0x04 /**< Dependency module sets for schema compilation. */ |
| 44 | ++#define LY_LDGSCHEMA 0x08 /**< Schema compilation and validation. */ |
| 45 | + |
| 46 | + /** |
| 47 | + * @} |
| 48 | +diff --git a/src/validation.c b/src/validation.c |
| 49 | +index 25be0feeb..8e308c61f 100644 |
| 50 | +--- a/src/validation.c |
| 51 | ++++ b/src/validation.c |
| 52 | +@@ -1624,7 +1624,7 @@ lyd_validate_obsolete(const struct lyd_node *node) |
| 53 | + if (snode->flags & LYS_STATUS_OBSLT && |
| 54 | + (!(snode->nodetype & LYD_NODE_INNER) || lyd_child(node))) { |
| 55 | + LOG_LOCSET(NULL, node); |
| 56 | +- LOGWRN(snode->module->ctx, "Obsolete schema node \"%s\" instantiated in data.", snode->name); |
| 57 | ++ LOGDBG(LY_LDGSCHEMA, snode->module->ctx, "Obsolete schema node \"%s\" instantiated in data.", snode->name); |
| 58 | + LOG_LOCBACK(0, 1); |
| 59 | + break; |
| 60 | + } |
| 61 | +-- |
| 62 | +2.43.0 |
| 63 | + |
0 commit comments