Use the content of the enviroment variable OSL_LOGLEVEL.
return msgstr.str + errmsgidx[num];
}
+static int loglevel;
+
+static void __attribute ((constructor)) init_loglevel(void)
+{
+ char *p = getenv("OSL_LOGLEVEL");
+
+ /* don't log anything if unset */
+ loglevel = p? atoi(p) : EMERG + 1;
+}
+
/**
* The log function.
*
time_t t1;
char str[255] = "";
- if (ll < 2)
+ if (ll < loglevel)
return;
outfd = stderr;
time(&t1);