Mumbleface logger - current time: formatting and logging

Please read 'COPYING' for license terms
To use in your code include the MFlogger header
#include <mflogger/log.h>
  // or
#include "/path/to/where/src/log.h"
There are two classes: log & timestring e.g. log data to a file
mflogger::log loggingfile("/path/to/log/file.log");
loggingfile.logmessage("there is something fishy going on");
This will result in something like this in the log file
2021-11-01T07:24:35 there is something fishy going on
2021-11-01T07:24:36 Barracuda
By default logging happens using local time in iso 8601 format.
This can be changed using the timeformat function. This function uses std::put_time formatting syntax or can be used with mflogger::timestring::format as an argument
loggingfile.timeformat(mflogger::timestring::format::HMS24);  // see timestring.h for enum mflogger::timestring::format values
  // or
loggingfile.timeformat("Making up a logging line prefix %H:%M);
Please look at logexample.cpp for examples
mflogger::log Interface
// constructor
log(const std::string& logfilename, const bool& append = true, timestring::format prefix = timestring::format::iso8601);

// close current logging file and open a new file
bool open(const std::string& logfilename, const bool& append = true);

// log message with timestamp/prefix. return the whole log line
std::string logmessage(const std::string& message);

// log message using time since epoch as the format
// see mflogger::timestring::precision enum for valid values for second argument, defaults to seconds
std::string logmessage_epoch(const std::string& message, timestring::precision p = timestring::precision::sec);

// stream various types to file
log& operator<<(const std::string& in);
log& operator<<(bool in);
log& operator<<(char in);
//   ... rest left our for brevity -- see log.h

// set the delimiter between time prefix and message, a space is the default - " "
void setdelimiter(const std::string& d);


Log's Base class timestring can be used just to get local time in a string
Can also be used to format the current time.

mflogger::timestring st;
st.time_asstring(); // will return (iso 8601 default) formatted current local time when called
st.epoch_asstring;  // will return seconds since epoch (in various formats)

// get current UTC time [zulu time]
st.ISO8601TimeUTC(); // in iso 8601 format
mflogger::timestring Interface
// constructor
timestring(timestring::format f = timestring::format::iso8601);

// return current time [format dependant on timeformat function call - referenced above in log class documentation]
std::string time_asstring();

// display time since epoch [various formats see enum mflogger::timestring::precision]
// second argument: if seconds and partial second delimit using this character or set of characters
std::string epoch_asstring(precision Precision = sec, std::string delimeter = ".")

// format the time output via time_asstring using std::put_time syntax
void timeformat(const std::string& FORMAT); { // see std::put_time to reference substitutions possible

// pre setup formatting - convenience
// one of:- iso8601, iso8601Z, iso8601z, HMS24, HMS12 -- see timestring::format
void timeformat(format FORMAT);
the end