GENIE
Logger.h
Go to the documentation of this file.
1 
6 #ifndef LOGGER_H_
7 #define LOGGER_H_
8 
9 #define LOGGER_MAX_FILE_NAME_SIZE 256
10 
11 #include <stdint.h>
12 #include <stdio.h>
13 #include <vector>
14 
15 
16 namespace genie
17 {
18  namespace query {struct Query;}
19  namespace table {struct inv_table;}
20  namespace table {struct inv_compr_table;}
21 
22 namespace utility
23 {
24 
25 
41 class Logger
42 {
43 public:
44 
45  static const int NONE = 0;
47  static const int ALERT = 1;
49  static const int INFO = 2;
51  static const int VERBOSE = 3;
53  static const int DEBUG = 4;
55  static const char * const LEVEL_NAMES[];
56 
57 
58 
63  virtual ~Logger();
64 
70  static void exit(void);
71 
89  static int log(int level, const char *fmt, ...);
90 
91  static void logQueries(int level, std::vector<genie::query::Query> &queries, size_t max_print_len = 128);
92 
93  static void logResults(int level, std::vector<genie::query::Query> &queries, std::vector<int> &result,
94  std::vector<int> &result_count, size_t max_print_len = 128);
95 
96  static void logTable(int level, genie::table::inv_table *table, size_t max_print_len = 32);
97 
98  static void logInvLists(int level, const std::vector<std::vector<uint32_t> > &rawInvertedLists,
99  size_t max_print_len = 128);
100 
112  static void set_level(int level);
113 
119  static int get_level();
120 
134  static void set_logfile_name(const char *name);
135 
141  static const char * get_logfile_name();
142 
143 private:
144 
148  static Logger * logger;
149 
153  int log_level;
154 
158  char logfile_name[LOGGER_MAX_FILE_NAME_SIZE];
159 
163  FILE * logfile;
164 
173  Logger(int level);
174 
186  static Logger* _logger(void);
187 };
188 
189 } // namespace utility
190 } // namesapce genie
191 
192 #endif
This is the top-level namespace of the project.
The declaration for class inv_table.
Definition: inv_table.h:41
#define LOGGER_MAX_FILE_NAME_SIZE
Definition: Logger.h:9
Query class includes the functions for processing queries based on user&#39;s input.
A utility class to record logs into disk files.
Definition: Logger.h:41