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_json.c b/src/printer_json.c
index e234f92..327799b 100644
--- a/src/printer_json.c
+++ b/src/printer_json.c
@@ -537,7 +537,7 @@
     LY_ERR ret = LY_SUCCESS;
     struct lyd_node *iter;
     const struct lyd_node *prev_parent;
-    uint32_t prev_opts, prev_lo;
+    uint32_t prev_opts, temp_lo = 0;
 
     assert(any->schema->nodetype & LYD_NODE_ANY);
 
@@ -549,7 +549,7 @@
         uint32_t parser_options = LYD_PARSE_ONLY | LYD_PARSE_OPAQ | LYD_PARSE_STRICT;
 
         /* 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(pctx->ctx, any->value.mem, LYD_LYB, parser_options, 0, &iter) == LY_SUCCESS) {
@@ -559,8 +559,8 @@
             any->value_type = LYD_ANYDATA_DATATREE;
         }
 
-        /* turn loggin on again */
-        ly_log_options(prev_lo);
+        /* turn logging on again */
+        ly_temp_log_options(NULL);
     }
 
     switch (any->value_type) {