using namespace std;
+ const string component = "libsnapper";
+
+
bool
testLogLevel(LogLevel level)
{
- return callLogQuery(level, "libsnapper");
+ return callLogQuery(level, component);
}
logStreamClose(LogLevel level, const char* file, unsigned line, const char* func,
ostringstream* stream)
{
- callLogDo(level, "libsnapper", file, line, func, stream->str());
+ callLogDo(level, component, file, line, func, stream->str());
delete stream;
}
static void
- simple_log_do(LogLevel level, const char* component, const char* file, int line,
+ simple_log_do(LogLevel level, const string& component, const char* file, int line,
const char* func, const string& text)
{
static const char* ln[4] = { "DEB", "MIL", "WAR", "ERR" };
static bool
- simple_log_query(LogLevel level, const char* component)
+ simple_log_query(LogLevel level, const string& component)
{
return level != DEBUG;
}
void
- callLogDo(LogLevel level, const char* component, const char* file, int line,
+ callLogDo(LogLevel level, const string& component, const char* file, int line,
const char* func, const string& text)
{
if (log_do)
bool
- callLogQuery(LogLevel level, const char* component)
+ callLogQuery(LogLevel level, const string& component)
{
if (log_query)
return (log_query)(level, component);
/*
* Called function should be able to split content at newlines.
*/
- typedef void (*LogDo)(LogLevel level, const char* component, const char* file, int line,
+ typedef void (*LogDo)(LogLevel level, const string& component, const char* file, int line,
const char* func, const string& content);
- typedef bool (*LogQuery)(LogLevel level, const char* component);
+ typedef bool (*LogQuery)(LogLevel level, const string& component);
void setLogDo(LogDo log_do);
void setLogQuery(LogQuery log_query);
- void callLogDo(LogLevel level, const char* component, const char* file, int line,
+ void callLogDo(LogLevel level, const string& component, const char* file, int line,
const char* func, const string& text);
- bool callLogQuery(LogLevel level, const char* component);
+ bool callLogQuery(LogLevel level, const string& component);
void initDefaultLogger();