akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame^] | 1 | #ifndef NLSR_LOGGER_HPP |
| 2 | #define NLSR_LOGGER_HPP |
| 3 | |
| 4 | #define BOOST_LOG_DYN_LINK 1 |
| 5 | #include "boost-log.hpp" |
| 6 | |
| 7 | #include <stdexcept> |
| 8 | #include <string> |
| 9 | #include <iostream> |
| 10 | #include <sstream> |
| 11 | #include <pwd.h> |
| 12 | #include <cstdlib> |
| 13 | #include <string> |
| 14 | #include <unistd.h> |
| 15 | #include <boost/format.hpp> |
| 16 | #include <boost/smart_ptr/shared_ptr.hpp> |
| 17 | #include <boost/date_time/posix_time/posix_time.hpp> |
| 18 | #include <boost/date_time/local_time/local_time.hpp> |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | namespace nlsr { |
| 24 | |
| 25 | namespace logging = boost::log; |
| 26 | namespace attrs = boost::log::attributes; |
| 27 | namespace src = boost::log::sources; |
| 28 | namespace sinks = boost::log::sinks; |
| 29 | namespace expr = boost::log::expressions; |
| 30 | namespace keywords = boost::log::keywords; |
| 31 | |
| 32 | using boost::shared_ptr; |
| 33 | using namespace std; |
| 34 | |
| 35 | |
| 36 | class Logger |
| 37 | { |
| 38 | public: |
| 39 | Logger() |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | void |
| 44 | initialize(std::string dirPath); |
| 45 | |
| 46 | src::logger& |
| 47 | getLogger() |
| 48 | { |
| 49 | return m_Logger; |
| 50 | } |
| 51 | |
| 52 | private: |
| 53 | string |
| 54 | getEpochTime(); |
| 55 | |
| 56 | string |
| 57 | getUserHomeDirectory(); |
| 58 | |
| 59 | private: |
| 60 | src::logger m_Logger; |
| 61 | }; |
| 62 | |
| 63 | }//namespace nlsr |
| 64 | #endif //NLSR_LOGGER_HPP |