[Groonga-commit] groonga/groonga at a9c204e [master] groonga-httpd: use grn_log_level_parse()

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jul 27 17:44:29 JST 2015


Kouhei Sutou	2015-07-27 17:44:29 +0900 (Mon, 27 Jul 2015)

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

  Message:
    groonga-httpd: use grn_log_level_parse()

  Modified files:
    src/httpd/nginx-module/ngx_http_groonga_module.c

  Modified: src/httpd/nginx-module/ngx_http_groonga_module.c (+1 -21)
===================================================================
--- src/httpd/nginx-module/ngx_http_groonga_module.c    2015-07-27 17:44:16 +0900 (9bd8ab2)
+++ src/httpd/nginx-module/ngx_http_groonga_module.c    2015-07-27 17:44:29 +0900 (b510329)
@@ -1162,27 +1162,7 @@ ngx_http_groonga_conf_set_log_level_slot(ngx_conf_t *cf, ngx_command_t *cmd,
 
   value = ngx_str_null_terminate(cf->cycle->pool,
                                  ((ngx_str_t *)cf->args->elts) + 1);
-  if (strcasecmp(value, "none") == 0) {
-    groonga_location_conf->log_level = GRN_LOG_NONE;
-  } else if (strcasecmp(value, "emergency") == 0) {
-    groonga_location_conf->log_level = GRN_LOG_EMERG;
-  } else if (strcasecmp(value, "alert") == 0) {
-    groonga_location_conf->log_level = GRN_LOG_ALERT;
-  } else if (strcasecmp(value, "critical") == 0) {
-    groonga_location_conf->log_level = GRN_LOG_CRIT;
-  } else if (strcasecmp(value, "error") == 0) {
-    groonga_location_conf->log_level = GRN_LOG_ERROR;
-  } else if (strcasecmp(value, "warning") == 0) {
-    groonga_location_conf->log_level = GRN_LOG_WARNING;
-  } else if (strcasecmp(value, "notice") == 0) {
-    groonga_location_conf->log_level = GRN_LOG_NOTICE;
-  } else if (strcasecmp(value, "info") == 0) {
-    groonga_location_conf->log_level = GRN_LOG_INFO;
-  } else if (strcasecmp(value, "debug") == 0) {
-    groonga_location_conf->log_level = GRN_LOG_DEBUG;
-  } else if (strcasecmp(value, "dump") == 0) {
-    groonga_location_conf->log_level = GRN_LOG_DUMP;
-  } else {
+  if (!grn_log_level_parse(value, &(groonga_location_conf->log_level))) {
     status = "must be one of 'none', 'emergency', 'alert', "
       "'critical', 'error', 'warning', 'notice', 'info', 'debug' and 'dump'";
   }
-------------- next part --------------
HTML����������������������������...
Download 



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