From 9968379aee5be5b5875ac7732c52e59059f30a0e Mon Sep 17 00:00:00 2001 From: Mubashshir Date: Thu, 2 Nov 2023 14:21:18 +0600 Subject: Bump logger version for breaking changes Signed-off-by: Mubashshir --- src/system-stats/common.h | 7 +++++-- src/system-stats/logger.cpp | 31 +++++++++++++++---------------- src/system-stats/system-stats.cpp | 1 + 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/system-stats/common.h b/src/system-stats/common.h index 230690d..08aceca 100644 --- a/src/system-stats/common.h +++ b/src/system-stats/common.h @@ -3,9 +3,12 @@ #include #include #include - -#define APP_VERSION "2.2" #define APP_NAME "system-stats" +#define APP_MAJOR 3 +#define APP_MINOR 0 + +#define VERSION_STRING(MAJOR, MINOR) #MAJOR "." #MINOR +#define APP_VERSION VERSION_STRING(APP_MAJOR, APP_MINOR) using refstream = std::reference_wrapper; diff --git a/src/system-stats/logger.cpp b/src/system-stats/logger.cpp index 418e693..319e184 100644 --- a/src/system-stats/logger.cpp +++ b/src/system-stats/logger.cpp @@ -25,21 +25,20 @@ const std::string LogFile::date() void demo_perms(std::filesystem::perms p) { - using std::filesystem::perms; - auto show = [=](char op, perms perm) - { - std::cerr << (perms::none == (perm & p) ? '-' : op); - }; - show('r', perms::owner_read); - show('w', perms::owner_write); - show('x', perms::owner_exec); - show('r', perms::group_read); - show('w', perms::group_write); - show('x', perms::group_exec); - show('r', perms::others_read); - show('w', perms::others_write); - show('x', perms::others_exec); - std::cerr << '\n'; + using std::filesystem::perms; + auto show = [=](char op, perms perm) { + std::cerr << (perms::none == (perm & p) ? '-' : op); + }; + show('r', perms::owner_read); + show('w', perms::owner_write); + show('x', perms::owner_exec); + show('r', perms::group_read); + show('w', perms::group_write); + show('x', perms::group_exec); + show('r', perms::others_read); + show('w', perms::others_write); + show('x', perms::others_exec); + std::cerr << '\n'; } LogFile::LogFile() @@ -78,5 +77,5 @@ void LogFile::change(refstream& fstr) } if(not stream.is_open()) - stream.open(base / (date_ + ".log")); + stream.open(base / (date_ + ".log"), std::ios::app); } diff --git a/src/system-stats/system-stats.cpp b/src/system-stats/system-stats.cpp index 6a9549c..6f6555a 100644 --- a/src/system-stats/system-stats.cpp +++ b/src/system-stats/system-stats.cpp @@ -19,6 +19,7 @@ int main() ).count(); stream.get() << "begin\t" << epoch << std::endl; + stream.get() << "ver\t" << APP_MAJOR << "\t" << APP_MINOR << std::endl; stream.get() << dumpReport(); stream.get() << "end\t" << epoch << std::endl; -- cgit v1.2.3