1
0
Fork 0

httpd: don't spam the console with debug messages

This commit is contained in:
Torsten Dreyer 2014-03-17 16:38:53 +01:00
parent 1867ccb4a8
commit efcc89480d
5 changed files with 10 additions and 13 deletions

View file

@ -59,7 +59,7 @@ bool JsonUriHandler::handleGetRequest( const HTTPRequest & request, HTTPResponse
if( false == node.valid() ) {
response.StatusCode = 400;
response.Content = "Node not found: " + propertyPath;
SG_LOG(SG_NETWORK,SG_ALERT, response.Content );
SG_LOG(SG_NETWORK,SG_WARN, "Node not found: '" << response.Content << "'");
return true;
}

View file

@ -43,7 +43,7 @@ PropertyChangeWebsocket::~PropertyChangeWebsocket()
void PropertyChangeWebsocket::close()
{
SG_LOG(SG_NETWORK, SG_ALERT, "closing PropertyChangeWebsocket #" << id);
SG_LOG(SG_NETWORK, SG_INFO, "closing PropertyChangeWebsocket #" << id);
_watchedNodes.clear();
}
@ -96,7 +96,7 @@ void PropertyChangeWebsocket::update(WebsocketWriter & writer)
string newValue;
if (_propertyChangeObserver->isChangedValue(node)) {
SG_LOG(SG_NETWORK, SG_ALERT, "httpd: new Value for " << node->getPath(true) << " '" << node->getStringValue() << "' #" << id);
SG_LOG(SG_NETWORK, SG_DEBUG, "httpd: new Value for " << node->getPath(true) << " '" << node->getStringValue() << "' #" << id);
writer.writeText( JSON::toJsonString( false, node, 0 ) );
}
}
@ -108,22 +108,20 @@ void PropertyChangeWebsocket::WatchedNodesList::handleCommand(const string & com
if (command == "addListener") {
for (iterator it = begin(); it != end(); ++it) {
if (node == (*it)->getPath(true)) {
SG_LOG(SG_NETWORK, SG_ALERT, "httpd: " << command << " '" << node << "' ignored (duplicate)");
SG_LOG(SG_NETWORK, SG_WARN, "httpd: " << command << " '" << node << "' ignored (duplicate)");
return; // dupliate
}
}
SGPropertyNode_ptr n = propertyChangeObserver->addObservation(node);
if (n.valid()) push_back(n);
SG_LOG(SG_NETWORK, SG_ALERT, "httpd: " << command << " '" << node << "'");
} else if (command == "removeListener") {
for (iterator it = begin(); it != end(); ++it) {
if (node == (*it)->getPath(true)) {
this->erase(it);
SG_LOG(SG_NETWORK, SG_ALERT, "httpd: " << command << " '" << node << "'");
return;
}
SG_LOG(SG_NETWORK, SG_ALERT, "httpd: " << command << " '" << node << "' ignored (not found)");
SG_LOG(SG_NETWORK, SG_WARN, "httpd: " << command << " '" << node << "' ignored (not found)");
}
}
}

View file

@ -244,7 +244,7 @@ bool PropertyUriHandler::handleGetRequest( const HTTPRequest & request, HTTPResp
fgSetString( propertyPath.c_str(), value );
}
catch( string & s ) {
SG_LOG(SG_NETWORK,SG_ALERT, "httpd: setting " << propertyPath << " to '" << value << "' failed: " << s );
SG_LOG(SG_NETWORK,SG_WARN, "httpd: setting " << propertyPath << " to '" << value << "' failed: " << s );
}
}
@ -257,7 +257,7 @@ bool PropertyUriHandler::handleGetRequest( const HTTPRequest & request, HTTPResp
fgSetString( pp, it->second );
}
catch( string & s ) {
SG_LOG(SG_NETWORK,SG_ALERT, "httpd: setting " << pp << " to '" << it->second << "' failed: " << s );
SG_LOG(SG_NETWORK,SG_WARN, "httpd: setting " << pp << " to '" << it->second << "' failed: " << s );
}
}
}
@ -288,7 +288,7 @@ bool PropertyUriHandler::handleGetRequest( const HTTPRequest & request, HTTPResp
node = fgGetNode( string("/") + propertyPath );
}
catch( string & s ) {
SG_LOG(SG_NETWORK,SG_ALERT, "httpd: reading '" << propertyPath << "' failed: " << s );
SG_LOG(SG_NETWORK,SG_WARN, "httpd: reading '" << propertyPath << "' failed: " << s );
}
if( false == node.valid() ) {
DOMNode * headline = new DOMNode( "h3" );

View file

@ -54,7 +54,7 @@ bool RunUriHandler::handleRequest( const HTTPRequest & request, HTTPResponse & r
}
response.Content = "command '" + command + "' failed.";
SG_LOG( SG_NETWORK, SG_ALERT, response.Content );
SG_LOG( SG_NETWORK, SG_WARN, response.Content );
return true;
}

View file

@ -141,7 +141,6 @@ void MongooseHttpd::init()
rewrites.append( fgRoot ).append( 1, '/' ).append( rhs );
}
}
SG_LOG(SG_NETWORK,SG_ALERT,"url-rewrites='" << rewrites << "'" );
if( false == rewrites.empty() )
mg_set_option(_server, "url_rewrites", rewrites.c_str() );
}
@ -266,7 +265,7 @@ int MongooseHttpd::websocketHandler(struct mg_connection * connection)
Websocket * websocket = static_cast<Websocket*>(connection->connection_param);
if ( NULL == websocket) {
if (request.Uri.find("/PropertyListener") == 0) {
SG_LOG(SG_ALL, SG_ALERT, "new PropertyChangeWebsocket for: " << request.Uri);
SG_LOG(SG_ALL, SG_INFO, "new PropertyChangeWebsocket for: " << request.Uri);
websocket = new PropertyChangeWebsocket(&_propertyChangeObserver);
connection->connection_param = websocket;
} else {