mirror of https://github.com/vitalif/grive2
added --log-xml for debugging (#80)
parent
e375d92b82
commit
fd81cc1fe4
|
@ -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 ) ;
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue