Ficed the log level display for level app
[yaz-moved-to-github.git] / util / log.c
index 5fa4d5e..9fe712e 100644 (file)
@@ -1,8 +1,8 @@
 /*
- * Copyright (c) 1995-2002, Index Data
+ * Copyright (c) 1995-2003, Index Data
  * See the file LICENSE for details.
  *
- * $Id: log.c,v 1.32 2002-12-05 12:19:24 adam Exp $
+ * $Id: log.c,v 1.35 2003-02-11 16:35:17 heikki Exp $
  */
 
 #if HAVE_CONFIG_H
@@ -52,7 +52,8 @@ static struct {
     { LOG_LOG,   "log"  },
     { LOG_ERRNO, ""},
     { LOG_MALLOC, "malloc"},
-    { LOG_ALL,   "all"  },
+    { LOG_APP,   "app"  },
+ /*   { LOG_ALL,   "all"  }, */
     { 0,         "none" },
     { 0, NULL }
 };  
@@ -70,8 +71,8 @@ void yaz_log_init_file (const char *fname)
     if (!l_file)
         l_file = stderr;
     if (!fname || !*fname)
-        return;
-    if (!(new_file = fopen(fname, "a")))
+       new_file=stderr;
+    else if (!(new_file = fopen(fname, "a")))
         return;
     if (l_file != stderr)
     {
@@ -106,7 +107,8 @@ void yaz_log_init(int level, const char *prefix, const char *fname)
 {
     yaz_log_init_level (level);
     yaz_log_init_prefix (prefix);
-    yaz_log_init_file (fname);
+    if (fname && *fname)
+        yaz_log_init_file (fname);
 }
 
 static void (*start_hook_func)(int, const char *, void *) = NULL;