about summary refs log tree commit diff stats
path: root/src/log.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-02-03 00:27:43 +0000
committerJames Booth <boothj5@gmail.com>2013-02-03 00:27:43 +0000
commitc90c83f7e1e2a3dc9aa28baa959bc45cf4fe6362 (patch)
treea8a7d54aacb0b49e9d3c5d5e07a9e29fb19200f9 /src/log.c
parent7d6ce4da0271babfce08d19899563b1065feedef (diff)
downloadprofani-tty-c90c83f7e1e2a3dc9aa28baa959bc45cf4fe6362.tar.gz
Removed log function to log.c
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/log.c b/src/log.c
index 86db07ae..df64a7b3 100644
--- a/src/log.c
+++ b/src/log.c
@@ -20,6 +20,7 @@
  *
  */
 
+#include <assert.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -161,6 +162,21 @@ log_msg(log_level_t level, const char * const area, const char * const msg)
     }
 }
 
+log_level_t
+log_level_from_string(char *log_level)
+{
+    assert(log_level != NULL);
+    if (strcmp(log_level, "DEBUG") == 0) {
+        return PROF_LEVEL_DEBUG;
+    } else if (strcmp(log_level, "INFO") == 0) {
+        return PROF_LEVEL_INFO;
+    } else if (strcmp(log_level, "WARN") == 0) {
+        return PROF_LEVEL_WARN;
+    } else {
+        return PROF_LEVEL_ERROR;
+    }
+}
+
 static void
 _rotate_log_file(void)
 {