OSDN Git Service

Add unit test code
[ultramonkey-l7/ultramonkey-l7-v3.git] / l7vsd / unit_tests / session_test / logger_stb / logger.h
1
2 #ifndef LOGGER_H
3 #define LOGGER_H
4
5 #include <string>
6 #include <logger_enum.h>
7 namespace l7vs{
8
9
10
11
12 //! @class Logger
13 //! @brief Logger creation class.
14 //! @brief this class create Logger Inmlement class and mediate function.
15 class Logger{
16 //    protected:
17 //        const LOG_CATEGORY_TAG    scopedLogCategory;
18 //        const unsigned int        scopedLogId;
19 //        const std::string        scopedLogMessage;
20 //        const char*                scopedLogFile;
21 //        const int                scopedLogLine;
22
23     public:
24     //! default constructor creates implement class.
25         Logger();
26         
27     //! log output constractor
28     //! scoped log output( Logger destractor output log)
29     //! @param[in]    Log output category tag
30     //! @param[in]    log id
31     //! @param[in]    log message
32     //!    @param[in]    filename    (=__FILE__)
33     //! @param[in]    lineno        (=__LINE__)
34         Logger( LOG_CATEGORY_TAG, const unsigned int, const std::string&, const char*, int);
35         static LOG_CATEGORY_TAG Logger_category;
36         static int Logger_id;
37         static std::string Logger_message;
38         static char* Logger_filename;
39         static int Logger_lineno;
40         
41     //! destructor.(output log then use log output constractor)
42         ~Logger();
43         
44         static void initilize(LOG_LEVEL_TAG test_level);
45         
46         static LOG_LEVEL_TAG test_loglevel;
47         
48     //! load Configuration.
49         void loadConf();
50
51     //! retrieve category's log level.
52     //! @param[in]    logcategory
53     //! @return        loglevel
54         static LOG_LEVEL_TAG getLogLevel( LOG_CATEGORY_TAG );
55         static LOG_CATEGORY_TAG     getLogLevel_category;
56
57     //! set category's log level.
58     //!    @param[in]    logcategory
59     //!    @param[in]    loglevel
60     //!    @return true    success loglevel change
61     //!    @return    false    failer loglevel change
62         static bool setLogLevel(LOG_CATEGORY_TAG cat, LOG_LEVEL_TAG level);
63         static LOG_CATEGORY_TAG     setLogLevel_category;
64         static LOG_LEVEL_TAG         setLogLevel_level;
65
66     //! output fatal log.
67     //! @param[in]    Log output category tag
68     //! @param[in]    log id
69     //! @param[in]    log message
70     //!    @param[in]    filename    (=__FILE__)
71     //! @param[in]    lineno        (=__LINE__)
72         static void putLogFatal( LOG_CATEGORY_TAG, const unsigned int, const std::string&, const char*, int );
73         static LOG_CATEGORY_TAG     putLogFatal_category;
74         static int                     putLogFatal_id;
75         static std::string             putLogFatal_message;
76         static char*                 putLogFatal_filename;
77         static int                     putLogFatal_lineno;
78
79     //! output error log.
80     //! @param[in]    Log output category tag
81     //! @param[in]    log id
82     //! @param[in]    log message
83     //!    @param[in]    filename    (=__FILE__)
84     //! @param[in]    lineno        (=__LINE__)
85         static void putLogError(LOG_CATEGORY_TAG, const unsigned int, const std::string&, const char*, int );
86         static LOG_CATEGORY_TAG     putLogError_category;
87         static int                     putLogError_id;
88         static std::string             putLogError_message;
89         static char*                 putLogError_filename;
90         static int                     putLogError_lineno;
91
92     //! output warn log.
93     //! @param[in]    Log output category tag
94     //! @param[in]    log id
95     //! @param[in]    log message
96     //!    @param[in]    filename    (=__FILE__)
97     //! @param[in]    lineno        (=__LINE__)
98         static void putLogWarn(LOG_CATEGORY_TAG, const unsigned int, const std::string&, const char*, int );
99         static LOG_CATEGORY_TAG     putLogWarn_category;
100         static int                     putLogWarn_id;
101         static std::string             putLogWarn_message;
102         static char*                 putLogWarn_filename;
103         static int                     putLogWarn_lineno;
104
105     //! output info log.
106     //! @param[in]    Log output category tag
107     //! @param[in]    log id
108     //! @param[in]    log message
109     //!    @param[in]    filename    (=__FILE__)
110     //! @param[in]    lineno        (=__LINE__)
111         static void putLogInfo(LOG_CATEGORY_TAG, const unsigned int, const std::string&, const char*, int );
112         static LOG_CATEGORY_TAG     putLogInfo_category;
113         static int                     putLogInfo_id;
114         static std::string             putLogInfo_message;
115         static char*                 putLogInfo_filename;
116         static int                     putLogInfo_lineno;
117
118     //! output debug log.
119     //! @param[in]    Log output category tag
120     //! @param[in]    log id
121     //! @param[in]    log message
122     //!    @param[in]    filename    (=__FILE__)
123     //! @param[in]    lineno        (=__LINE__)
124         static void putLogDebug(LOG_CATEGORY_TAG, const unsigned int, const std::string&, const char*, int );
125         static LOG_CATEGORY_TAG     putLogDebug_category;
126         static int                     putLogDebug_id;
127         static std::string             putLogDebug_message;
128         static char*                 putLogDebug_filename;
129         static int                     putLogDebug_lineno;
130         
131 };
132
133 }    //namespace l7vs
134
135 #endif    //LOGGER_H