v0.0.4
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
/* The maximum length of the log message */
|
||||
#define OSFP_MAX_LOG_MSG_LEN 2048
|
||||
|
||||
unsigned int osfp_log_level = OSFP_LOG_LEVEL_INFO;
|
||||
unsigned int g_osfp_log_level = OSFP_LOG_LEVEL_WARNING;
|
||||
|
||||
void osfp_log_message(unsigned int x, const char *file, const int line, const char *func, const char *msg)
|
||||
{
|
||||
@@ -32,11 +32,15 @@ void osfp_log_message(unsigned int x, const char *file, const int line, const ch
|
||||
break;
|
||||
}
|
||||
|
||||
if (fprintf(stdout, "%s\n", buffer) < 0) {
|
||||
printf("Error writing to stream using fprintf\n");
|
||||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void osfp_log(unsigned int x, const char *file, const int line, const char *func, const char *fmt, ...)
|
||||
{
|
||||
if (osfp_log_level >= x ) {
|
||||
if (g_osfp_log_level <= x ) {
|
||||
char msg[OSFP_MAX_LOG_MSG_LEN];
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
@@ -46,8 +50,8 @@ void osfp_log(unsigned int x, const char *file, const int line, const char *func
|
||||
}
|
||||
}
|
||||
|
||||
void osfp_log_level_set(osfp_log_level_t level)
|
||||
void osfp_log_level_set(enum osfp_log_level level)
|
||||
{
|
||||
osfp_log_level = level;
|
||||
g_osfp_log_level = level;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user