ewmscp  ..
Functions
errMsgTest.cpp File Reference

(v0.19-24-g0617ca1 with changes)

#include "../errMsgQueue.h"
#include <list>
Include dependency graph for errMsgTest.cpp:

Go to the source code of this file.

Functions

void produceMsg (int i)
 
int main (int argc, const char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
const char *  argv[] 
)

Definition at line 9 of file errMsgTest.cpp.

9  {
10  std::thread errPrinter(errMsg::message::printMsgs);
11  errMsg::emit(errMsg::level::debug,errMsg::location(),"we have ", argc, " args" , argv[0]);
12 
13  std::list<std::thread> threads;
14  for (int i=0; i<argc; i++) {
15  threads.emplace_back(produceMsg,i);
16  }
17  for (auto& t : threads) {
18  t.join();
19  }
20  errMsg::message::getQueue().signalDone();
21  errPrinter.join();
22 }

References errMsg::debug, errMsg::emit(), errMsg::message::getQueue(), errMsg::message::printMsgs(), and produceMsg().

Here is the call graph for this function:

◆ produceMsg()

void produceMsg ( int  i)

Definition at line 3 of file errMsgTest.cpp.

3  {
5  std::this_thread::sleep_for(std::chrono::seconds(i));
7 }

References errMsg::emit(), errMsg::err, and errMsg::info.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:
errMsg::location
class for defining the location of a error message in the source code.
Definition: errMsgQueue.h:14
errMsg::level::info
@ info
errMsg::message::getQueue
static waitQueues::simple< message > & getQueue()
get reference to teh message queue
Definition: errMsgQueue.h:90
errMsg::level::debug
@ debug
errMsg::message::printMsgs
static void printMsgs()
simple printer function for messages, can be used as a std::thread
Definition: errMsgQueue.h:95
produceMsg
void produceMsg(int i)
Definition: errMsgTest.cpp:3
errMsg::level::err
@ err
errMsg::emit
void emit(level aLogLevel, const location &loc, const std::string &aObject, const std::string &aAction, const Args &... args)
function to create and enqueue a message, this is the only way that messages should be created!
Definition: errMsgQueue.h:148