summaryrefslogtreecommitdiffstats
path: root/src/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/log.c b/src/log.c
index 4c46804..21c5e7d 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1,3 +1,6 @@
+#ifndef SC_LOGLEVEL
+#define SC_LOGLEVEL "SC_LOG_ERROR SC_LOG_WARNING SC_LOG_INFO SC_LOG_DEBUG"
+#endif
const char * sc_log_str (SC_OPT_TYPE t) {
switch (t & SC_LOG_MASK) {
case SC_LOG_ERROR:
@@ -24,9 +27,11 @@ struct sc_logentry * sc_logentry_init () {
return l;
}
#endif
-int sc_push_log (unsigned char t, struct sc_cache * c, const char * ca, char * f, size_t l, unsigned short int isf, char * m, ...) {
+int sc_push_log (SC_OPT_TYPE t, struct sc_cache * c, const char * ca, char * f, size_t l, unsigned short int isf, char * m, ...) {
#define SC_PLL c->logentries[c->logentries_length-1]
char * compiled_message = NULL;
+ if (!strstr(getenv("SC_LOGLEVEL") ? getenv("SC_LOGLEVEL") : SC_LOGLEVEL, sc_log_str(t)))
+ return 0;
#ifdef SC_LOGMEM
if (!c)
return -1;