Archived
1
0
Fork 0

log.c: added logstrtolvl

This commit is contained in:
Henrik Hautakoski 2010-11-28 17:19:25 +01:00
parent 6b2465dce2
commit 80ad7d0daa
2 changed files with 17 additions and 0 deletions

View file

@ -120,6 +120,21 @@ const char* loglvltostr(unsigned level) {
return "UNKNOWN";
}
unsigned logstrtolvl(const char *str) {
int i;
if (strcmp(str, "ALL") == 0)
return LOG_ALL;
for(i=0; levels[i].name; i++) {
if (strcmp(str, levels[i].name) == 0)
return levels[i].mask;
}
return 0;
}
void logmsg(unsigned level, const char *fmt, ...) {
va_list vl;

View file

@ -21,6 +21,8 @@
void init_log(unsigned level, const char *path);
unsigned logstrtolvl(const char *str);
const char* loglvltostr(unsigned level);
void logmsg(unsigned level, const char *fmt, ...);