YANG parser CHANGE support for including submodules
diff --git a/src/log.c b/src/log.c
index 57da747..b576437 100644
--- a/src/log.c
+++ b/src/log.c
@@ -34,6 +34,19 @@
 /* how many bytes add when enlarging buffers */
 #define LY_BUF_STEP 128
 
+API LY_ERR
+ly_errcode(const struct ly_ctx *ctx)
+{
+    struct ly_err_item *i;
+
+    i = ly_err_first(ctx);
+    if (i) {
+        return i->prev->no;
+    }
+
+    return LY_SUCCESS;
+}
+
 API LY_VECODE
 ly_vecode(const struct ly_ctx *ctx)
 {