Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-02 08:43:50

0001 #ifndef LOGGER_MESSAGE_H
0002 #define LOGGER_MESSAGE_H
0003 
0004 /**
0005  * @file LoggerMessage.h
0006  * @author Bryan BERTHOU (SPhN / CEA Saclay)
0007  * @date 05 September 2014
0008  * @version 1.0
0009  */
0010 
0011 #include <ctime>
0012 #include <iostream>
0013 #include <string>
0014 
0015 #include "LoggerLevel.h"
0016 
0017 class LoggerMessage;
0018 
0019 namespace ElemUtils {
0020 
0021 /**
0022  * @class LoggerMessage
0023  * @brief
0024  */
0025 class LoggerMessage {
0026 public:
0027     LoggerMessage(LoggerLevel level, std::string classNameSource,
0028             std::string functionNameSource, std::string message);
0029     ~LoggerMessage();
0030 
0031     std::string formatDate(const time_t &time) const;
0032 
0033     const std::time_t& getTime() const;
0034     void setTime(std::time_t time);
0035     const std::string& getClassNameSource() const;
0036     void setClassNameSource(const std::string& classNameSource);
0037     const std::string& getFunctionNameSource() const;
0038     void setFunctionNameSource(const std::string& functionNameSource);
0039     const std::string& getMessage() const;
0040     void setMessage(const std::string& message);
0041     LoggerLevel getLevel() const;
0042     void setLevel(LoggerLevel level);
0043 
0044     void serialize(std::stringstream &sstream) const;
0045 
0046     std::string toString() const;
0047 
0048 private:
0049     LoggerLevel m_level;
0050     std::time_t m_time;
0051     std::string m_classNameSource;
0052     std::string m_functionNameSource;
0053     std::string m_message;
0054 };
0055 
0056 } // namespace ElemUtils
0057 
0058 std::stringstream& operator <<(std::stringstream& sstream,
0059         LoggerMessage& loggerMessage);
0060 
0061 #endif /* LOGGER_MESSAGE_H */