]> arthur.barton.de Git - netatalk.git/commitdiff
renamed the -setuplogtype optione to -[un]setuplog, where unsetting a log simply...
authorsibaz <sibaz>
Sat, 24 Aug 2002 02:12:43 +0000 (02:12 +0000)
committersibaz <sibaz>
Sat, 24 Aug 2002 02:12:43 +0000 (02:12 +0000)
config/afpd.conf.tmpl
etc/afpd/afp_options.c
libatalk/util/logger.c

index 7a2b19ae3989c7cfcfb442752f89c89b2b84cb6d..713dcb70c45da07fe33dabe369428ea0ba9ef5f6 100644 (file)
 #                         timing out a connection.  The default is 4, therefore
 #                         a connection will timeout in 2 minutes.
 #     -icon               Use the platform-specific icon.
+#
+#   OPTIONS IN DEVELOPMENT:
+#     -[un]setuplog <logtype> <loglevel> [<filename>]
+#                         Specify that the given loglevel should be applied
+#                         to log messages of the given logtype and that 
+#                         these messages should be logged to the given file.
+#                         If the filename is ommited the loglevel applies to 
+#                         messages passed to syslog.  
+#                         Each logtype may have a loglevel applied to syslog 
+#                         and a loglevel applied to a single file.  Latter
+#                         -setuplog settings will override earlier ones of
+#                         the same logtype (file or syslog).
 #              
 # Some examples:
 #
index 3196e8f7cfea0170f58aeae8ca18903a13884e51..aad7916d52c5aca36fdfb0921ca162e602cdf7d1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: afp_options.c,v 1.25 2002-08-24 01:32:19 sibaz Exp $
+ * $Id: afp_options.c,v 1.26 2002-08-24 02:12:48 sibaz Exp $
  *
  * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
@@ -249,8 +249,8 @@ int afp_options_parseline(char *buf, struct afp_options *options)
 
 #ifndef DISABLE_LOGGER
     /* -setuplogtype <syslog|filelog> <logtype> <loglevel> <filename>*/
-    /* -setuplogtype <logtype> <loglevel> [<filename>]*/
-    if ((c = getoption(buf, "-setuplogtype")))
+    /* -[no]setuplog <logtype> <loglevel> [<filename>]*/
+    if ((c = getoption(buf, "-setuplog")))
     {
       char *ptr, *logsource, *logtype, *loglevel, *filename;
 
@@ -317,6 +317,55 @@ int afp_options_parseline(char *buf, struct afp_options *options)
       /* setuplog(logsource, logtype, loglevel, filename); */
       setuplog(logtype, loglevel, filename);
     }
+
+    if ((c = getoption(buf, "-nosetuplog")))
+    {
+      char *ptr, *logtype, *loglevel, *filename;
+
+      LOG(log_extradebug, logtype_afpd, "un setting up logtype, c is %s", c);
+
+      ptr = c;
+      logtype = ptr;
+      if (ptr)
+      {
+        ptr = strpbrk(ptr, " \t");
+        if (ptr)
+        {
+          *ptr++ = 0;
+          while (*ptr && isspace(*ptr))
+            ptr++;
+        }
+      }
+
+      loglevel = ptr;
+      if (ptr)
+      {
+        ptr = strpbrk(ptr, " \t");
+        if (ptr)
+        {
+          *ptr++ = 0;
+           while (*ptr && isspace(*ptr))
+             ptr++;
+        }
+      }
+
+      filename = ptr;
+      if (ptr)
+      {
+        ptr = strpbrk(ptr, " \t");
+        if (ptr)
+        {
+          *ptr++ = 0;
+          while (*ptr && isspace(*ptr))
+            ptr++;
+        }
+      }
+      
+      LOG(log_extradebug, logtype_afpd, "Doing setuplog %s %s %s",
+              logtype, NULL, filename);
+
+      setuplog(logtype, NULL, filename);
+    }
 #endif /* DISABLE_LOGGER */
 #ifdef ADMIN_GRP
     if ((c = getoption(buf, "-admingroup"))) {
index 1bf8b7dee08b8296e4735e516c368d5f6aa8280f..a79e4cf64b9a2e80e6d76d98300829153f44cbd3 100644 (file)
@@ -935,6 +935,7 @@ void setuplog(char *logtype, char *loglevel, char *filename)
   if (logtype==NULL)
   {
     LOG(log_note, logtype_logger, "no logsource given");
+    typenum=0;
   }
   else
   {
@@ -952,6 +953,7 @@ void setuplog(char *logtype, char *loglevel, char *filename)
   if (loglevel==NULL)
   {
     LOG(log_note, logtype_logger, "no loglevel given");
+    levelnum=0;
   }
   else
   {