}
}
-static int get_loglevel_by_name(const char *txt, size_t n)
-{
- if (!strncasecmp(txt, "debug", n))
- return LL_DEBUG;
- if (!strncasecmp(txt, "info", n))
- return LL_INFO;
- if (!strncasecmp(txt, "notice", n))
- return LL_NOTICE;
- if (!strncasecmp(txt, "warning", n))
- return LL_WARNING;
- if (!strncasecmp(txt, "error", n))
- return LL_ERROR;
- if (!strncasecmp(txt, "crit", n))
- return LL_CRIT;
- if (!strncasecmp(txt, "emerg", n))
- return LL_EMERG;
- return -1;
-}
-
/**
* Set the color for one loglevel.
*
if (!p)
goto err;
- ret = get_loglevel_by_name(arg, p - arg);
+ ret = get_loglevel_by_name(arg);
if (ret < 0)
goto err;
ll = ret;
*
* \param loglevel The smallest level that should be logged.
*/
-void daemon_set_loglevel(int loglevel)
+void daemon_set_loglevel(char *loglevel)
{
- me->loglevel = loglevel;
+ int ret = get_loglevel_by_name(loglevel);
+
+ assert(ret >= 0);
+ me->loglevel = ret;
}
/**
/**
* Log the startup message containing the paraslash version.
*/
-void log_welcome(const char *whoami, int loglevel)
+void log_welcome(const char *whoami)
{
PARA_INFO_LOG("welcome to %s " PACKAGE_VERSION " ("BUILD_DATE")\n",
whoami);
- PARA_DEBUG_LOG("using loglevel %d\n", loglevel);
}
/**