fix redraw at top-left of map
[Tsunagari.git] / src / log.h
blob32f5daf407cc8de86abe06068037c12b24e25b2e
1 /******************************
2 ** Tsunagari Tile Engine **
3 ** log.h **
4 ** Copyright 2011 OmegaSDG **
5 ******************************/
7 #ifndef LOG_H
8 #define LOG_H
10 #include <iostream>
11 #include <string>
13 //! Logging Mode Enum
14 /*!
15 This enum defines the logging modes.
17 enum message_mode_t {
18 MM_SILENT = 1, // Only error messages are sent to the console.
19 MM_DEVELOPER, // Error messages and development messages are sent to the
20 // console.
21 MM_DEBUG // All messages are sent to the console.
24 //! Log Class
25 /*!
26 This is a singleton that handles error messages.
28 class Log
30 public:
31 //! Set message mode. (SILENT, DEVELOPER, or DEBUG)
32 static void setMode(message_mode_t mode);
34 //! Send a message to the console.
35 /*!
36 @param domain the name of the message's origin (traditionally,
37 the name of the function we're in)
38 @param message the message to be sent
40 static void err(std::string domain, std::string message);
41 static void dev(std::string domain, std::string message);
42 static void dbg(std::string domain, std::string message);
44 //! Send a blank line to the console.
45 static void blank();
47 private:
48 static Log* instance(); // Access to our singleton instance.
49 static std::string& rtrim(std::string& str);
51 Log(); // Hide our constructor.
53 static Log* pInstance; // Our class instance.
54 message_mode_t mode; // Message mode that has been set.
57 #endif