mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-11-30 10:47:40 +08:00
Modify log output
This commit is contained in:
parent
2cff4a3457
commit
6c444ec6ca
@ -82,7 +82,6 @@ namespace drogon{
|
||||
HttpApiBinder(FUNCTION &&func):
|
||||
_func(std::forward<FUNCTION>(func))
|
||||
{
|
||||
//LOG_DEBUG<<"traits name:"<<traits::name();
|
||||
static_assert(traits::isHTTPApiFunction,"Your API handler function interface is wrong!");
|
||||
}
|
||||
void test(){
|
||||
|
@ -45,7 +45,7 @@ namespace drogon
|
||||
static void registerMethod(const std::string &methodName,const std::string &pattern,FUNCTION &&function,const std::vector<std::string> &filters)
|
||||
{
|
||||
std::string path=std::string("/")+HttpApiController<T>::classTypeName();
|
||||
LOG_DEBUG<<"classname:"<<HttpApiController<T>::classTypeName();
|
||||
LOG_TRACE<<"classname:"<<HttpApiController<T>::classTypeName();
|
||||
if(!methodName.empty())
|
||||
{
|
||||
path.append("/");
|
||||
|
@ -75,7 +75,7 @@ namespace drogon
|
||||
FUNCTION && function,
|
||||
const std::vector<std::string> &filters=std::vector<std::string>())
|
||||
{
|
||||
LOG_DEBUG<<"pathPattern:"<<pathPattern;
|
||||
LOG_TRACE<<"pathPattern:"<<pathPattern;
|
||||
HttpApiBinderBasePtr binder;
|
||||
|
||||
binder=std::make_shared<
|
||||
|
@ -62,7 +62,7 @@ namespace drogon
|
||||
|
||||
for(auto path:vPaths)
|
||||
{
|
||||
LOG_DEBUG<<"register simple controller("<<HttpSimpleController<T>::classTypeName()<<") on path:"<<path.first;
|
||||
LOG_TRACE<<"register simple controller("<<HttpSimpleController<T>::classTypeName()<<") on path:"<<path.first;
|
||||
HttpAppFramework::instance().registerHttpSimpleController(path.first,HttpSimpleController<T>::classTypeName(),path.second);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ namespace drogon
|
||||
|
||||
for(auto path:vPaths)
|
||||
{
|
||||
LOG_DEBUG<<"register websocket controller ("<<WebSocketController<T>::classTypeName()<<") on path:"<<path.first;
|
||||
LOG_TRACE<<"register websocket controller ("<<WebSocketController<T>::classTypeName()<<") on path:"<<path.first;
|
||||
HttpAppFramework::instance().registerWebSocketController(path.first,
|
||||
WebSocketController<T>::classTypeName(),
|
||||
path.second);
|
||||
|
@ -1,3 +1,17 @@
|
||||
/**
|
||||
*
|
||||
* @file
|
||||
* @author An Tao
|
||||
* @section LICENSE
|
||||
*
|
||||
* Copyright 2018, An Tao. All rights reserved.
|
||||
* Use of this source code is governed by a MIT license
|
||||
* that can be found in the License file.
|
||||
*
|
||||
* @section DESCRIPTION
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tuple>
|
||||
|
@ -1,3 +1,17 @@
|
||||
/**
|
||||
*
|
||||
* @file
|
||||
* @author An Tao
|
||||
* @section LICENSE
|
||||
*
|
||||
* Copyright 2018, An Tao. All rights reserved.
|
||||
* Use of this source code is governed by a MIT license
|
||||
* that can be found in the License file.
|
||||
*
|
||||
* @section DESCRIPTION
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <uuid/uuid.h>
|
||||
|
@ -66,7 +66,7 @@ void HttpAppFrameworkImpl::initRegex() {
|
||||
}
|
||||
if(regString.length()>0)
|
||||
regString.resize(regString.length()-1);//remove last '|'
|
||||
LOG_DEBUG<<"regex string:"<<regString;
|
||||
LOG_TRACE<<"regex string:"<<regString;
|
||||
_apiRegex=std::regex(regString);
|
||||
}
|
||||
void HttpAppFrameworkImpl::registerWebSocketController(const std::string &pathName,
|
||||
@ -203,7 +203,7 @@ void HttpAppFrameworkImpl::run()
|
||||
initRegex();
|
||||
for(auto listener:_listeners)
|
||||
{
|
||||
LOG_DEBUG<<"thread num="<<_threadNum;
|
||||
LOG_TRACE<<"thread num="<<_threadNum;
|
||||
#ifdef __linux__
|
||||
for(size_t i=0;i<_threadNum;i++)
|
||||
{
|
||||
@ -592,7 +592,7 @@ void HttpAppFrameworkImpl::onAsyncRequest(const HttpRequestPtr& req,const std::f
|
||||
{
|
||||
size_t ctlIndex=i-1;
|
||||
auto &binder=_apiCtrlVector[ctlIndex];
|
||||
LOG_DEBUG<<"got api access,regex="<<binder.pathParameterPattern;
|
||||
LOG_TRACE<<"got api access,regex="<<binder.pathParameterPattern;
|
||||
auto &filters=binder.filtersName;
|
||||
doFilters(filters,req,callback,needSetJsessionid,session_id,[=](){
|
||||
std::vector<std::string> params(binder.parameterPlaces.size());
|
||||
@ -605,7 +605,7 @@ void HttpAppFrameworkImpl::onAsyncRequest(const HttpRequestPtr& req,const std::f
|
||||
if(place>params.size())
|
||||
params.resize(place);
|
||||
params[place-1]=r[j].str();
|
||||
LOG_DEBUG<<"place="<<place<<" para:"<<params[place-1];
|
||||
LOG_TRACE<<"place="<<place<<" para:"<<params[place-1];
|
||||
}
|
||||
}
|
||||
if(binder.queryParametersPlaces.size()>0)
|
||||
@ -626,7 +626,7 @@ void HttpAppFrameworkImpl::onAsyncRequest(const HttpRequestPtr& req,const std::f
|
||||
std::list<std::string> paraList;
|
||||
for(auto p:params)
|
||||
{
|
||||
LOG_DEBUG<<p;
|
||||
LOG_TRACE<<p;
|
||||
paraList.push_back(std::move(p));
|
||||
}
|
||||
|
||||
@ -692,7 +692,7 @@ void HttpAppFrameworkImpl::readSendFile(const std::string& filePath,const HttpRe
|
||||
std::string modiStr=req->getHeader("If-Modified-Since");
|
||||
if(modiStr!=""&&modiStr==lastModified)
|
||||
{
|
||||
LOG_DEBUG<<"not Modified!";
|
||||
LOG_TRACE<<"not Modified!";
|
||||
resp->setStatusCode(HttpResponse::k304NotModified);
|
||||
return;
|
||||
}
|
||||
|
@ -93,10 +93,10 @@ void HttpRequestImpl::parsePremeter()
|
||||
}
|
||||
|
||||
}
|
||||
LOG_DEBUG<<"_parameters:";
|
||||
LOG_TRACE<<"_parameters:";
|
||||
for(auto iter:_parameters)
|
||||
{
|
||||
LOG_DEBUG<<iter.first<<"="<<iter.second;
|
||||
LOG_TRACE<<iter.first<<"="<<iter.second;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -75,7 +75,6 @@ void SharedLibManager::managerLibs()
|
||||
for(auto libPath:_libPaths)
|
||||
{
|
||||
forEachFileIn(libPath,[=](const std::string &filename,const struct stat &st){
|
||||
//LOG_DEBUG<<filename;
|
||||
auto pos=filename.rfind(".");
|
||||
if(pos!=std::string::npos)
|
||||
{
|
||||
@ -98,7 +97,7 @@ void SharedLibManager::managerLibs()
|
||||
if(st.st_mtimespec.tv_sec>_dlMap[filename].mTime.tv_sec)
|
||||
#endif
|
||||
{
|
||||
LOG_DEBUG<<"new csp file:"<<filename;
|
||||
LOG_TRACE<<"new csp file:"<<filename;
|
||||
oldHandle=_dlMap[filename].handle;
|
||||
}
|
||||
else
|
||||
@ -110,7 +109,7 @@ void SharedLibManager::managerLibs()
|
||||
}
|
||||
std::string cmd="drogon_ctl create view ";
|
||||
cmd.append(filename).append(" -o ").append(libPath);
|
||||
LOG_DEBUG<<cmd;
|
||||
LOG_TRACE<<cmd;
|
||||
system(cmd.c_str());
|
||||
auto srcFile=filename.substr(0,pos);
|
||||
srcFile.append(".cc");
|
||||
@ -131,7 +130,7 @@ void SharedLibManager::managerLibs()
|
||||
_dlMap[filename]=dlStat;
|
||||
}
|
||||
_loop->runAfter(3.5,[=](){
|
||||
LOG_DEBUG<<"remove file "<<lockFile;
|
||||
LOG_TRACE<<"remove file "<<lockFile;
|
||||
if(unlink(lockFile.c_str())==-1)
|
||||
perror("");
|
||||
});
|
||||
@ -143,7 +142,7 @@ void SharedLibManager::managerLibs()
|
||||
|
||||
}
|
||||
void* SharedLibManager::loadLibs(const std::string &sourceFile,void *oldHld) {
|
||||
LOG_DEBUG<<"src:"<<sourceFile;
|
||||
LOG_TRACE<<"src:"<<sourceFile;
|
||||
std::string cmd="g++ ";
|
||||
cmd.append(sourceFile).append(" ")
|
||||
.append(compileFlags).append(includeDirs).append(" -shared -fPIC --no-gnu-unique -o ");
|
||||
@ -154,16 +153,16 @@ void* SharedLibManager::loadLibs(const std::string &sourceFile,void *oldHld) {
|
||||
void *Handle = nullptr;
|
||||
if(system(cmd.c_str())==0)
|
||||
{
|
||||
LOG_DEBUG<<"Compiled successfully";
|
||||
LOG_TRACE<<"Compiled successfully";
|
||||
if(oldHld)
|
||||
{
|
||||
if(dlclose(oldHld)==0)
|
||||
{
|
||||
LOG_DEBUG<<"close dynamic lib successfully:"<<oldHld;
|
||||
LOG_TRACE<<"close dynamic lib successfully:"<<oldHld;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG<<dlerror();
|
||||
LOG_TRACE<<dlerror();
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,7 +175,7 @@ void* SharedLibManager::loadLibs(const std::string &sourceFile,void *oldHld) {
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG<<"Successfully loaded library file "<<soFile;
|
||||
LOG_TRACE<<"Successfully loaded library file "<<soFile;
|
||||
}
|
||||
}
|
||||
return Handle;
|
||||
|
Loading…
Reference in New Issue
Block a user