From 2a8e9717ead2f88091362173af65bc3fafd30361 Mon Sep 17 00:00:00 2001 From: Sebastian Martin Dicke Date: Tue, 13 Aug 2019 15:07:24 +0200 Subject: [PATCH 1/2] Add a additional version of init. --- src/simple_logger.cpp | 5 +++++ src/simple_logger.hpp | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/simple_logger.cpp b/src/simple_logger.cpp index d4ce36c..9624e95 100644 --- a/src/simple_logger.cpp +++ b/src/simple_logger.cpp @@ -287,6 +287,11 @@ Logger::Logger() { } +void Logger::init(std::string filename, Append append) +{ + Logger::init(filename, static_cast(append)); +} + void Logger::init(std::string filename, bool append) { Impl::init(filename, append); diff --git a/src/simple_logger.hpp b/src/simple_logger.hpp index 1bd0920..97acef1 100644 --- a/src/simple_logger.hpp +++ b/src/simple_logger.hpp @@ -66,6 +66,12 @@ class Logger EpochMicroseconds }; + enum class Append : bool + { + NoAppend = false, + Append = true + }; + //! Constructor. Logger(); @@ -78,6 +84,12 @@ class Logger * Throws on error. */ static void init(std::string filename, bool append = false); + /*! Initialize the logger. + * \param filename Log to filename. Disabled if empty. + * \param append The existing log will be appended if Append. + * Throws on error. */ + static void init(std::string filename, Append append); + //! Enable/disable echo mode. //! \param enable Echo everything if true. Default is false. static void enableEchoMode(bool enable); From deb6d7d65b383773b839a7b2a8491478b4da829e Mon Sep 17 00:00:00 2001 From: Sebastian Martin Dicke Date: Tue, 13 Aug 2019 15:12:31 +0200 Subject: [PATCH 2/2] Change function description. --- src/simple_logger.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/simple_logger.hpp b/src/simple_logger.hpp index 97acef1..fa75215 100644 --- a/src/simple_logger.hpp +++ b/src/simple_logger.hpp @@ -84,7 +84,7 @@ class Logger * Throws on error. */ static void init(std::string filename, bool append = false); - /*! Initialize the logger. + /*! Initialize the logger using an enum type for append mode. * \param filename Log to filename. Disabled if empty. * \param append The existing log will be appended if Append. * Throws on error. */