mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
added log printouts. Added hardcoded REST configuration
This commit is contained in:
@ -74,14 +74,11 @@ class RestHelper {
|
||||
*/
|
||||
|
||||
//Check for http:// string
|
||||
FILE_LOG(logDEBUG) << __func__ << " starting";
|
||||
FILE_LOG(logDEBUG4) << __func__ << " starting";
|
||||
string proto_str = "http://";
|
||||
|
||||
if( size_t found = hostname.find(proto_str) != string::npos ){
|
||||
cout << hostname << endl;
|
||||
|
||||
char c1[hostname.size()-found-1];
|
||||
cout << c1 << endl;
|
||||
size_t length1 = hostname.copy(c1, hostname.size()-found-1, proto_str.size());
|
||||
c1[length1]='\0';
|
||||
hostname = c1;
|
||||
@ -168,7 +165,7 @@ class RestHelper {
|
||||
string answer;
|
||||
int code = send_request(session, req, &answer);
|
||||
if(code == 0 ) {
|
||||
FILE_LOG(logDEBUG) << "ANSWER " << answer;
|
||||
FILE_LOG(logDEBUG4) << "REQUEST: " << " ANSWER: " << answer;
|
||||
json_value->loadFromString(answer);
|
||||
}
|
||||
delete uri;
|
||||
@ -192,7 +189,6 @@ class RestHelper {
|
||||
if (path.empty()) path = "/";
|
||||
HTTPRequest req(HTTPRequest::HTTP_POST, path, HTTPMessage::HTTP_1_1 );
|
||||
req.setContentType("application/json\r\n");
|
||||
cout << "REQUEST BODY " << request_body << endl;
|
||||
req.setContentLength( request_body.length() );
|
||||
int code = send_request(session, req, answer, request_body);
|
||||
|
||||
@ -266,9 +262,8 @@ class RestHelper {
|
||||
if (request_body == "")
|
||||
session->sendRequest( (req) );
|
||||
else{
|
||||
cout << request_body << endl;
|
||||
ostream &os = session->sendRequest( req ) ;
|
||||
os << request_body;
|
||||
ostream &os = session->sendRequest( req ) ;
|
||||
os << request_body;
|
||||
}
|
||||
|
||||
HTTPResponse res;
|
||||
@ -276,7 +271,7 @@ class RestHelper {
|
||||
StreamCopier::copyToString(is, *answer);
|
||||
code = res.getStatus();
|
||||
if (code != 200){
|
||||
cout << "HTTP ERROR " << res.getStatus() << ": " << res.getReason() << endl;
|
||||
FILE_LOG(logERROR) << "HTTP ERROR " << res.getStatus() << ": " << res.getReason() ;
|
||||
code = -1;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user