]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - string.c
fecdec: Minor cleanups.
[paraslash.git] / string.c
index ba32e8bfbddc9b314cfcf78011b4f85bc6322906..3c80d27cc6b6ad73a95392c17cdb041837ec6ba5 100644 (file)
--- a/string.c
+++ b/string.c
@@ -586,3 +586,22 @@ int para_atoi32(const char *str, int32_t *value)
        *value = tmp;
        return 1;
 }
+
+int get_loglevel_by_name(const char *txt)
+{
+       if (!strcasecmp(txt, "debug"))
+               return LL_DEBUG;
+       if (!strcasecmp(txt, "info"))
+               return LL_INFO;
+       if (!strcasecmp(txt, "notice"))
+               return LL_NOTICE;
+       if (!strcasecmp(txt, "warning"))
+               return LL_WARNING;
+       if (!strcasecmp(txt, "error"))
+               return LL_ERROR;
+       if (!strcasecmp(txt, "crit"))
+               return LL_CRIT;
+       if (!strcasecmp(txt, "emerg"))
+               return LL_EMERG;
+       return -1;
+}