log BUGFIX thread-safe temporary logging options

Logging options were being modified to disable
logging for specific tasks but when executed
in several threads, the options were not restored
correctly.
diff --git a/src/printer_xml.c b/src/printer_xml.c
index c7a6c85..e45eb2b 100644
--- a/src/printer_xml.c
+++ b/src/printer_xml.c
@@ -385,7 +385,7 @@
 {
     struct lyd_node_any *any = (struct lyd_node_any *)node;
     struct lyd_node *iter;
-    uint32_t prev_opts, prev_lo;
+    uint32_t prev_opts, temp_lo = 0;
     LY_ERR ret;
 
     if ((node->schema->nodetype == LYS_ANYDATA) && (node->value_type != LYD_ANYDATA_DATATREE)) {
@@ -402,7 +402,7 @@
     } else {
         if (any->value_type == LYD_ANYDATA_LYB) {
             /* turn logging off */
-            prev_lo = ly_log_options(0);
+            ly_temp_log_options(&temp_lo);
 
             /* try to parse it into a data tree */
             if (lyd_parse_data_mem((struct ly_ctx *)LYD_CTX(node), any->value.mem, LYD_LYB,
@@ -414,7 +414,7 @@
             }
 
             /* turn logging on again */
-            ly_log_options(prev_lo);
+            ly_temp_log_options(NULL);
         }
 
         switch (any->value_type) {