Rev 1594 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1594 | Rev 1964 | ||
|---|---|---|---|
| Line 20... | Line 20... | ||
| 20 | 20 | ||
| 21 | #ifndef LOGGING_LOGGER_H |
21 | #ifndef LOGGING_LOGGER_H |
| 22 | #define LOGGING_LOGGER_H |
22 | #define LOGGING_LOGGER_H |
| 23 | 23 | ||
| 24 | #include <string> |
24 | #include <string> |
| 25 | #include <fstream> |
- | |
| 26 | - | ||
| 27 | #include <boost/thread/mutex.hpp> |
- | |
| 28 | 25 | ||
| 29 | namespace atom { |
26 | namespace atom { |
| 30 | namespace logging { |
27 | namespace logging { |
| 31 | 28 | ||
| 32 | class Logger |
29 | class Logger |
| 33 | { |
30 | { |
| 34 | public: |
31 | public: |
| 35 | typedef enum |
- | |
| 36 | { |
- | |
| 37 | LEVEL_NONE = 0, |
- | |
| 38 | LEVEL_ERROR = 1, |
- | |
| 39 | LEVEL_WARNING = 2, |
- | |
| 40 | LEVEL_INFO = 3, |
- | |
| 41 | LEVEL_DEBUG = 4, |
- | |
| 42 | LEVEL_ALL = 5 |
- | |
| 43 | } Level; |
- | |
| 44 | - | ||
| 45 | Logger(std::string name); |
32 | Logger(std::string name); |
| 46 | virtual ~Logger(); |
33 | virtual ~Logger(); |
| 47 | 34 | ||
| 48 | void Error(std::string message); |
35 | void Error(std::string message); |
| 49 | void Warning(std::string message); |
36 | void Warning(std::string message); |
| 50 | void Info(std::string message); |
37 | void Info(std::string message); |
| 51 | void Debug(std::string message); |
38 | void Debug(std::string message); |
| 52 | 39 | ||
| 53 | static void SetLevel(Level level); |
- | |
| 54 | static bool OpenFile(std::string filename); |
- | |
| 55 | static void CloseFile(); |
- | |
| 56 | - | ||
| 57 | private: |
40 | private: |
| 58 | static Level level_; |
- | |
| 59 | static std::ofstream file_; |
- | |
| 60 | static boost::mutex mutex_; |
- | |
| 61 | - | ||
| 62 | std::string name_; |
41 | std::string name_; |
| 63 | - | ||
| 64 | void Print(std::string line); |
- | |
| 65 | }; |
42 | }; |
| 66 | 43 | ||
| 67 | }; // namespace logging |
44 | }; // namespace logging |
| 68 | }; // namespace atom |
45 | }; // namespace atom |
| 69 | 46 | ||