blob: ca6be3e80f5205a70e124e5e13740e214aaf0b0c [file] [log] [blame]
akmhoqueba094742014-02-28 11:47:21 -06001#ifndef NLSR_LOGGER_HPP
2#define NLSR_LOGGER_HPP
3
4#define BOOST_LOG_DYN_LINK 1
Yingdi Yu40cd1c32014-04-17 15:02:17 -07005#include "boost-log.hpp"
akmhoqueba094742014-02-28 11:47:21 -06006
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>
Yingdi Yu40cd1c32014-04-17 15:02:17 -070019
20
21
akmhoqueba094742014-02-28 11:47:21 -060022
23namespace nlsr
24{
25
akmhoque5a44dd42014-03-12 18:11:32 -050026 namespace logging = boost::log;
27 namespace attrs = boost::log::attributes;
28 namespace src = boost::log::sources;
29 namespace sinks = boost::log::sinks;
30 namespace expr = boost::log::expressions;
31 namespace keywords = boost::log::keywords;
akmhoqueba094742014-02-28 11:47:21 -060032
akmhoque5a44dd42014-03-12 18:11:32 -050033 using boost::shared_ptr;
34 using namespace std;
akmhoqueba094742014-02-28 11:47:21 -060035
36
akmhoque5a44dd42014-03-12 18:11:32 -050037 class NlsrLogger
38 {
39 public:
40 NlsrLogger()
akmhoqueba094742014-02-28 11:47:21 -060041 {
akmhoque5a44dd42014-03-12 18:11:32 -050042 }
akmhoqueba094742014-02-28 11:47:21 -060043
akmhoque5a44dd42014-03-12 18:11:32 -050044 void initNlsrLogger(std::string dirPath);
akmhoqueba094742014-02-28 11:47:21 -060045
akmhoque5a44dd42014-03-12 18:11:32 -050046 src::logger& getLogger()
47 {
48 return mLogger;
49 }
akmhoqueba094742014-02-28 11:47:21 -060050
akmhoque5a44dd42014-03-12 18:11:32 -050051 private:
52 string getEpochTime();
53 string getUserHomeDirectory();
akmhoqueba094742014-02-28 11:47:21 -060054
akmhoque5a44dd42014-03-12 18:11:32 -050055 private:
56 src::logger mLogger;
57 };
akmhoqueba094742014-02-28 11:47:21 -060058
59}//namespace nlsr
60#endif