From 628e6341993f77e4f25c1f745fde5368ec2d1e15 Mon Sep 17 00:00:00 2001 From: "Miso Zmiric (Mike Squinter)" Date: Tue, 9 Jun 2015 19:54:09 +0100 Subject: [PATCH] closes #1204, add log_info --- src/diagnostic.c | 5 +++-- src/diagnostic.h | 2 ++ src/object_list.c | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/diagnostic.c b/src/diagnostic.c index 95c5661356..d2d06d5f7d 100644 --- a/src/diagnostic.c +++ b/src/diagnostic.c @@ -23,14 +23,15 @@ #include #include "diagnostic.h" -int _log_levels[DIAGNOSTIC_LEVEL_COUNT] = { 1, 1, 1, 0 }; +int _log_levels[DIAGNOSTIC_LEVEL_COUNT] = { 1, 1, 1, 0, 1 }; int _log_location_enabled = 1; const char * _level_strings[] = { "FATAL", "ERROR", "WARNING", - "VERBOSE" + "VERBOSE", + "INFO" }; void diagnostic_log(int diagnosticLevel, const char *format, ...) diff --git a/src/diagnostic.h b/src/diagnostic.h index 749618847c..4b63bb29c5 100644 --- a/src/diagnostic.h +++ b/src/diagnostic.h @@ -26,6 +26,7 @@ enum { DIAGNOSTIC_LEVEL_ERROR, DIAGNOSTIC_LEVEL_WARNING, DIAGNOSTIC_LEVEL_VERBOSE, + DIAGNOSTIC_LEVEL_INFORMATION, DIAGNOSTIC_LEVEL_COUNT }; @@ -42,6 +43,7 @@ void diagnostic_log_with_location(int diagnosticLevel, const char *file, const c #define log_error(format, ...) diagnostic_log_macro(DIAGNOSTIC_LEVEL_ERROR, format, __VA_ARGS__) #define log_warning(format, ...) diagnostic_log_macro(DIAGNOSTIC_LEVEL_WARNING, format, __VA_ARGS__) #define log_verbose(format, ...) diagnostic_log(DIAGNOSTIC_LEVEL_VERBOSE, format, __VA_ARGS__) +#define log_info(format, ...) diagnostic_log_macro(DIAGNOSTIC_LEVEL_INFORMATION, format, __VA_ARGS__) #else diff --git a/src/object_list.c b/src/object_list.c index 4082f7e22f..0b566bc384 100644 --- a/src/object_list.c +++ b/src/object_list.c @@ -350,6 +350,21 @@ static int object_list_cache_load(int totalFiles, uint64 totalFileSize, int file return 1; } } + else if (pluginHeader.total_files != totalFiles) { + int fileCount = totalFiles - pluginHeader.total_files; + if (fileCount < 0) { + log_info("%d object removed... updating object list cache", abs(fileCount)); + } else { + log_info("%d object added... updating object list cache", fileCount); + } + } else if (pluginHeader.total_file_size != totalFileSize) { + log_info("Objects files size changed... updating object list cache"); + } else if (pluginHeader.date_modified_checksum != fileDateModifiedChecksum) { + log_info("Objects files have been updated... updating object list cache"); + } + + fclose(file); + return 0; } fclose(file);