There are four classes: logger, jsonlog, syslog & timestring
mflogger::logger loggingfile();
loggingfile.log();
loggingfile.log();
This will result in something like this in the log file
2025-11-01T07:24:35 there is something fishy going on
2025-11-01T07:24:36 Barracuda
e.g. log json data to a file
mflogger::jsonlog loggingfile();
loggingfile.log(, , );
loggingfile.log(, , );
This will result in something like this in the log file
{:,:,:}
{:,:,:}
e.g. You can use the std::vector version of the jsonlog class to add as many values as you wish in a log message
mflogger::jsonlog loggingfile();
std::vector<std::pair<std::string, std::string> > values;
values.push_back(std::make_pair(, ));
values.push_back(std::make_pair(, ));
values.push_back(std::make_pair(, ));
jlog.log(values, );
This will result in something like this in the log file
{:,:,:,:,:}
By default logging happens using local time in iso 8601 format.loggingfile.timeformat(mflogger::timestring::format::HMS24);
loggingfile.timeformat();
e.g. using mfsyslog
mflogger::mfsyslog log;
log.log(LOG_INFO, );
this should log using the syslog daemon
logger( std::string& logfilename, & append = , timestring::format prefix = timestring::format::iso8601);
logger();
open( std::string& logfilename, & append = );
good() ;
is_open() ;
std::string log( std::string& message);
std::string log_epoch( std::string& message, timestring::precision p = timestring::precision::sec);
logger& <<( std::string& in);
logger& <<( in);
logger& <<( in);
setdelimiter( std::string& d);
mflogger::jsonlog Interface derived from mflogger::log
jsonlog( std::string& logfilename, & append = , timestring::format prefix = timestring::format::iso8601);
jsonlog();
std::string log( std::string& logitem, std::string& value, std::string& level = );
std::string log( std::vector<std::pair<std::string, std::string> >& logdata, std::string& level = );
mflogger::mfsyslog Interface
mfsyslog( std::string& Prepend = , option = 0, facility = 0);
log( priority, std::string& data);
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.
e.g.
mflogger::timestring st;
st.time_asstring();
st.epoch_asstring;
st.ISO8601TimeUTC();
mflogger::timestring Interface
timestring(timestring::format f = timestring::format::iso8601);
std::string time_asstring();
std::string epoch_asstring(precision Precision = sec, std::string delimeter = )
timeformat( std::string& FORMAT); {
timeformat(format FORMAT);