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