Symulacja NAT na przedmiot Symulacje Komputerowe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
791 B

  1. /*
  2. * Log.h
  3. *
  4. * Created on: 16.01.2017
  5. * Author: piotrek
  6. */
  7. #ifndef LOG_H_
  8. #define LOG_H_
  9. #include "common.h"
  10. enum LOG_COLOR {
  11. BLACK,
  12. RED,
  13. GREEN,
  14. YELLOW,
  15. BLUE,
  16. MAGENTA,
  17. CYAN,
  18. WHITE
  19. };
  20. class Log
  21. {
  22. int lineNumber;
  23. LOG_COLOR color;
  24. string delimiter;
  25. string *objectName;
  26. pthread_mutex_t *writeMutex;
  27. protected:
  28. string* getObjectName() const;
  29. void setObjectName(string* objectName);
  30. public:
  31. Log();
  32. void print(string msg);
  33. LOG_COLOR getColor() const;
  34. void setColor(LOG_COLOR color);
  35. const string& getDelimiter() const;
  36. void setDelimiter(const string& delimiter);
  37. int getLineNumber() const;
  38. void setLineNumber(int lineNumber);
  39. void setLogParams(int lineNumber, LOG_COLOR color, string delimiter);
  40. static pthread_mutex_t * getMutex();
  41. };
  42. #endif /* LOG_H_ */