log.c: added logstrtolvl
This commit is contained in:
parent
6b2465dce2
commit
80ad7d0daa
2 changed files with 17 additions and 0 deletions
15
src/log.c
15
src/log.c
|
|
@ -120,6 +120,21 @@ const char* loglvltostr(unsigned level) {
|
||||||
return "UNKNOWN";
|
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, ...) {
|
void logmsg(unsigned level, const char *fmt, ...) {
|
||||||
|
|
||||||
va_list vl;
|
va_list vl;
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
void init_log(unsigned level, const char *path);
|
void init_log(unsigned level, const char *path);
|
||||||
|
|
||||||
|
unsigned logstrtolvl(const char *str);
|
||||||
|
|
||||||
const char* loglvltostr(unsigned level);
|
const char* loglvltostr(unsigned level);
|
||||||
|
|
||||||
void logmsg(unsigned level, const char *fmt, ...);
|
void logmsg(unsigned level, const char *fmt, ...);
|
||||||
|
|
|
||||||
Reference in a new issue