Commit c38e945c authored by Simon Morlat's avatar Simon Morlat

revert existance of SLOGA, which is hard to emulate when log backend is boostlog.

Furthermore, change comment so that both LOG*() and SLOG*() family of macro remain possible in flexisip (none is preferred nor recommended).
parent 400b4ea2
......@@ -433,15 +433,13 @@ template <typename _retType>
_retType *GenericStruct::get(const char *name)const{
GenericEntry *e=find(name);
if (e==NULL) {
SLOGA << "No ConfigEntry with name [" << name <<"] in struct [" << getName() <<"]" ;
LOGA("No ConfigEntry with name [%s] in struct [%s]",name,getName().c_str());
}
_retType *ret=dynamic_cast<_retType *>(e);
if (ret==NULL){
int status;
std::string type_name = abi::__cxa_demangle(typeid(_retType).name(), 0, 0, &status);
SLOGA <<"Config entry '" <<name<<"' in struct '"<<e->getParent()->getName()<<"' does not have the expected type '"<< type_name<<"'";
LOGA("Config entry [%s] in struct [%s] does not have the expected type '%s'.", name, e->getParent()->getName().c_str(), type_name.c_str() );
}
return ret;
};
......@@ -461,7 +459,7 @@ _retType *GenericStruct::getDeep(const char *name, bool strict)const{
GenericEntry *e=find(next_node_name.c_str());
if (!e) {
if (!strict) return NULL;
LOGE("No ConfigEntry with name %s in struct %s",name,prev_node->getName().c_str());
LOGE("No ConfigEntry with name [%s] in struct [%s]",name,prev_node->getName().c_str());
for (auto it=prev_node->mEntries.begin(); it != prev_node->mEntries.end(); ++it) {
LOGE("-> %s", (*it)->getName().c_str());
}
......@@ -470,7 +468,7 @@ _retType *GenericStruct::getDeep(const char *name, bool strict)const{
}
next_node=dynamic_cast<GenericStruct *>(e);
if (!next_node){
SLOGA << "Config entry "<<name<<" in struct "<<e->getParent()->getName()<<" does not have the expected type";
LOGA("Config entry [%s] in struct [%s] does not have the expected type", e->getName().c_str(),e->getParent()->getName().c_str());
return NULL;
}
prev_node=next_node;
......
......@@ -118,16 +118,17 @@ namespace log {
BOOST_LOG_DECLARE_GLOBAL_LOGGER(flexisip_logger, boost::log::sources::severity_logger_mt<flexisip::log::level>)
#endif
// Declare macros for stream logs [preferred way]
// Declare macros for stream logs
// ex: SLOGD << "Some debug level logs";
#define LOGDFN(boolfn, streamfn) formatedfn_log_with_severity(flexisip::log::level::debug, (boolfn), (streamfn))
#define SLOGD BOOST_LOG_SEV(flexisip_logger::get(), flexisip::log::level::debug)
#define SLOGI BOOST_LOG_SEV(flexisip_logger::get(), flexisip::log::level::info)
#define SLOGW BOOST_LOG_SEV(flexisip_logger::get(), flexisip::log::level::warning)
#define SLOGE BOOST_LOG_SEV(flexisip_logger::get(), flexisip::log::level::error)
#define SLOGA BOOST_LOG_SEV(flexisip_logger::get(), flexisip::log::level::fatal) abort();
// Declare macros for printf formated logs [for historic reasons]
/* unfortunately SLOGA cannot work over boostog, because it needs to call abort.
#define SLOGA BOOST_LOG_SEV(flexisip_logger::get(), flexisip::log::level::fatal)
*/
// Declare macros for printf formated logs
// ex: LOGD("Some debug level %s", "logs");
#define LOGDV(thefmt, theargs) flexisip::log::formated_log_with_severity(flexisip::log::level::debug, (thefmt), (theargs))
#define LOGD flexisip::log::formated_logd
......@@ -195,8 +196,9 @@ operator<<(pumpstream&& __os, const _Tp &__x)
#define SLOGI SLOG(ORTP_MESSAGE)
#define SLOGW SLOG(ORTP_WARNING)
#define SLOGE SLOG(ORTP_ERROR)
/*
#define SLOGA SLOGA_FL(__FILE__,__LINE__)
*/
#define LOGV(thelevel,thefmt, theargs) LOGDV((thefmt), (theargs))
#define LOGDV(thefmt, theargs) ortp_logv(ORTP_DEBUG, (thefmt), (theargs))
#define LOGD ortp_debug
......
......@@ -69,7 +69,8 @@ Module *ModuleFactory::createModuleInstance(Agent *ag, const string &modname) {
LOGI("Creating module instance for [%s]", m->getModuleName().c_str());
return m;
}
SLOGA << "Could not find any registered module with name ["<< modname <<"]";
LOGA("Could not find any registered module with name [%s]",modname.c_str());
return NULL;
}
void ModuleFactory::registerModule(ModuleInfoBase *m) {
......
......@@ -127,7 +127,7 @@ void Monitor::createAccounts() {
string localIP = findLocalAddress(nodes);
if(localIP == "") {
SLOGA << "Could not find local IP address";
LOGA("Monitor::createAccounts(): Could not find local IP address");
exit(-1);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment