area.cpp: fix pointer dereference
[Tsunagari.git] / src / log.h
blob97b491937145376f234f2c82152dcd8870e2440a
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, // 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 private:
45 static Log* instance(); // Access to our singleton instance.
46 static std::string& rtrim(std::string& str);
48 Log() {}; // Hide our constructor.
50 static Log* pInstance; // Our class instance.
51 message_mode_t mode; // Message mode that has been set.
54 #endif