X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=string.c;h=3c80d27cc6b6ad73a95392c17cdb041837ec6ba5;hb=89e28a4361bd120dfe4202a16d85d03fb1139de8;hp=ba32e8bfbddc9b314cfcf78011b4f85bc6322906;hpb=6bdac07456cb5872f824028912d1049883a9c21f;p=paraslash.git diff --git a/string.c b/string.c index ba32e8bf..3c80d27c 100644 --- 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; +}