Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added --log-xml for debugging (#80)

  • Loading branch information...
commit fd81cc1fe40f00cd6e65a1cc9930bad6b268712d 1 parent e375d92
@nestal nestal authored
View
4 grive/src/main.cc
@@ -82,6 +82,7 @@ int Main( int argc, char **argv )
( "version,v", "Display Grive version" )
( "auth,a", "Request authorization token" )
( "verbose,V", "Verbose mode. Enable more messages than normal.")
+ ( "log-xml", "Log more HTTP responses as XML for debugging.")
( "debug,d", "Enable debug level messages. Implies -v.")
( "log,l", po::value<std::string>(), "Set log output filename." )
( "force,f", "Force grive to always download a file from Google Drive "
@@ -146,6 +147,9 @@ int Main( int argc, char **argv )
{
console_log->Enable( log::verbose ) ;
}
+
+ options.Add( "log-xml", Json(vm.count("log-xml") > 0) ) ;
+
if ( vm.count( "debug" ) )
{
console_log->Enable( log::verbose ) ;
View
14 libgrive/src/drive/Drive.cc
@@ -27,7 +27,6 @@
#include "http/ResponseLog.hh"
#include "http/XmlResponse.hh"
#include "protocol/Json.hh"
-// #include "protocol/OAuth2.hh"
#include "util/Destroy.hh"
#include "util/log/Log.hh"
#include "xml/Node.hh"
@@ -54,8 +53,9 @@ namespace
}
Drive::Drive( http::Agent *http, const Json& options ) :
- m_http( http ),
- m_state( state_file, options )
+ m_http ( http ),
+ m_state ( state_file, options ),
+ m_log_xml ( options["log-xml"].Bool() )
{
assert( m_http != 0 ) ;
}
@@ -137,7 +137,9 @@ void Drive::DetectChanges()
Log( "Reading remote server file list", log::info ) ;
Feed feed ;
-// feed.EnableLog( "/tmp/file", ".xml" ) ;
+ if ( m_log_xml )
+ feed.EnableLog( "/tmp/file", ".xml" ) ;
+
feed.Start( m_http, http::Header(), feed_base + "?showfolders=true&showroot=true" ) ;
m_resume_link = feed.Root()["link"].
@@ -156,7 +158,9 @@ void Drive::DetectChanges()
{
Log( "Detecting changes from last sync", log::info ) ;
Feed changes ;
-// feed.EnableLog( "/tmp/changes", ".xml" ) ;
+ if ( m_log_xml )
+ feed.EnableLog( "/tmp/changes", ".xml" ) ;
+
feed.Start( m_http, http::Header(), ChangesFeed(prev_stamp+1) ) ;
std::for_each(
View
5 libgrive/src/drive/Drive.hh
@@ -58,11 +58,10 @@ private :
private :
http::Agent *m_http ;
-// OAuth2& m_auth ;
-// http::Header m_http_hdr ;
-
std::string m_resume_link ;
State m_state ;
+
+ bool m_log_xml ;
} ;
} // end of namespace
Please sign in to comment.
Something went wrong with that request. Please try again.