diff options
Diffstat (limited to 'src/libosfp_log.c')
| -rw-r--r-- | src/libosfp_log.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/libosfp_log.c b/src/libosfp_log.c index ddb0726..5b6ce34 100644 --- a/src/libosfp_log.c +++ b/src/libosfp_log.c @@ -1,9 +1,4 @@ -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <time.h> - -#include "libosfp.h" +#include "libosfp_common.h" #include "libosfp_log.h" /* The maximum length of the log message */ @@ -24,22 +19,22 @@ void libosfp_log_message(unsigned int x, const char *file, const int line, const switch (x) { case LIBOSFP_LOG_LEVEL_DEBUG: - snprintf(buffer, sizeof(buffer), "[%s][DEBUG][%s:%d %s] %s", log_time_buf, file, line, func, msg); + snprintf(buffer, sizeof(buffer), "[%s][DEBUG][%s:%d %s] %s\n", log_time_buf, file, line, func, msg); break; case LIBOSFP_LOG_LEVEL_INFO: - snprintf(buffer, sizeof(buffer), "[%s][INFO][%s:%d %s] %s", log_time_buf, file, line, func, msg); + snprintf(buffer, sizeof(buffer), "[%s][INFO][%s:%d %s] %s\n", log_time_buf, file, line, func, msg); break; case LIBOSFP_LOG_LEVEL_WARNING: - snprintf(buffer, sizeof(buffer), "[%s][WARN][%s:%d %s] %s", log_time_buf, file, line, func, msg); + snprintf(buffer, sizeof(buffer), "[%s][WARN][%s:%d %s] %s\n", log_time_buf, file, line, func, msg); break; case LIBOSFP_LOG_LEVEL_ERROR: - snprintf(buffer, sizeof(buffer), "[%s][ERROR][%s:%d %s] %s", log_time_buf, file, line, func, msg); + snprintf(buffer, sizeof(buffer), "[%s][ERROR][%s:%d %s] %s\n", log_time_buf, file, line, func, msg); break; } } -void libosfp_log(unsigned int x, const char *file, const char *func, const int line, const char *fmt, ...) +void libosfp_log(unsigned int x, const char *file, const int line, const char *func, const char *fmt, ...) { if (libosfp_log_level >= x ) { char msg[LIBOSFP_MAX_LOG_MSG_LEN]; |
