1 /******************************
2 ** Tsunagari Tile Engine **
4 ** Copyright 2011 OmegaSDG **
5 ******************************/
11 * Singleton enforcement.
15 static Log
* inst
= NULL
;
29 * Specify mode setting.
31 void Log::setMode(message_mode_t mode
)
38 * Give output to the "write" function if it is allowed to be sent in
41 void Log::err(std::string domain
, std::string message
)
43 std::cerr
<< "Error [" << domain
<< "] - " << rtrim(message
)
47 void Log::dev(std::string domain
, std::string message
)
50 if (l
->mode
== MM_DEBUG
|| l
->mode
== MM_DEVELOPER
)
51 std::cerr
<< "Devel [" << domain
<< "] - " << rtrim(message
)
55 void Log::dbg(std::string domain
, std::string message
)
58 if (l
->mode
== MM_DEBUG
)
59 std::cerr
<< "Debug [" << domain
<< "] - " << rtrim(message
)
65 std::cerr
<< std::endl
;
68 std::string
& Log::rtrim(std::string
& str
)
70 if (str
[str
.length()-1] == '\n')
71 str
[str
.length()-1] = '\0';