[Groonga-commit] groonga/groonga at c0e865b [master] grndb: support --log-level option

Back to archive index

Kentaro Hayashi null+****@clear*****
Wed Jun 7 16:09:40 JST 2017


Kentaro Hayashi	2017-06-07 16:09:40 +0900 (Wed, 07 Jun 2017)

  New Revision: c0e865bb6e546683a0e0fa99b97b43ef73af6377
  https://github.com/groonga/groonga/commit/c0e865bb6e546683a0e0fa99b97b43ef73af6377

  Merged 01a201e: Merge pull request #706 from kenhys/grndb-log-level

  Message:
    grndb: support --log-level option

  Modified files:
    src/grndb.c

  Modified: src/grndb.c (+20 -0)
===================================================================
--- src/grndb.c    2017-06-07 16:04:46 +0900 (e308a1f)
+++ src/grndb.c    2017-06-07 16:09:40 +0900 (321781b)
@@ -121,6 +121,7 @@ main(int argc, char **argv)
 {
   int exit_code = EXIT_SUCCESS;
   const char *log_path = GRN_LOG_PATH;
+  grn_log_level log_level = GRN_LOG_NOTICE;
 
   {
     int i;
@@ -148,6 +149,25 @@ main(int argc, char **argv)
         log_path = arg + strlen(log_path_equal_prefix);
       }
 #undef log_path_equal_prefix
+
+      if (strcmp(arg, "--log-level") == 0) {
+        if (i + 1 < argc) {
+          if (grn_log_level_parse(argv[i + 1], &log_level) == GRN_TRUE) {
+            grn_default_logger_set_max_level(log_level);
+          }
+        } else {
+          break;
+        }
+#define log_level_equal_prefix "--log-level="
+      } else if (strncmp(arg,
+                         log_level_equal_prefix,
+                         strlen(log_level_equal_prefix)) == 0) {
+        if (grn_log_level_parse(arg + strlen(log_level_equal_prefix), &log_level) == GRN_TRUE) {
+          grn_default_logger_set_max_level(log_level);
+        }
+      }
+#undef log_level_equal_prefix
+
     }
   }
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index