1 /******************************
2 ** Tsunagari Tile Engine **
4 ** Copyright 2011 OmegaSDG **
5 ******************************/
10 //! Singleton enforcement.
13 static Log
* inst
= new Log
;
22 //! Specify mode setting.
23 void Log::setMode(message_mode_t mode
)
30 * Give output to the "write" function if it is allowed to be sent in
33 void Log::err(std::string domain
, std::string message
)
35 std::cerr
<< "Error [" << domain
<< "] - " << rtrim(message
)
39 void Log::dev(std::string domain
, std::string message
)
42 if (l
->mode
== MM_DEBUG
|| l
->mode
== MM_DEVELOPER
)
43 std::cerr
<< "Devel [" << domain
<< "] - " << rtrim(message
)
47 void Log::dbg(std::string domain
, std::string message
)
50 if (l
->mode
== MM_DEBUG
)
51 std::cerr
<< "Debug [" << domain
<< "] - " << rtrim(message
)
57 std::cerr
<< std::endl
;
60 std::string
& Log::rtrim(std::string
& str
)
62 if (str
[str
.length()-1] == '\n')
63 str
[str
.length()-1] = '\0';