@@ -6,6 +6,8 @@ use crate::{Database, Result};
66
77use super :: DbType ;
88
9+ use tracing:: trace;
10+
911/// A builder for [`Database`]. This struct can be used to build
1012/// all variants of [`Database`]. These variants include:
1113///
@@ -363,6 +365,7 @@ cfg_replication! {
363365 use super :: SyncProtocol ;
364366 match sync_protocol {
365367 p @ ( SyncProtocol :: Auto | SyncProtocol :: V2 ) => {
368+ trace!( "Probing for sync protocol version for {}" , url) ;
366369 let client = hyper:: client:: Client :: builder( )
367370 . build:: <_, hyper:: Body >( connector. clone( ) ) ;
368371
@@ -381,6 +384,8 @@ cfg_replication! {
381384 . await
382385 . map_err( |err| crate :: Error :: Sync ( err. into( ) ) ) ?;
383386
387+ trace!( "Probe for sync protocol version for {} returned status {}" , url, res. status( ) ) ;
388+
384389 if res. status( ) == http:: StatusCode :: UNAUTHORIZED {
385390 return Err ( crate :: Error :: Sync ( "Unauthorized" . into( ) ) ) ;
386391 }
@@ -397,15 +402,18 @@ cfg_replication! {
397402 }
398403
399404 if res. status( ) . is_success( ) {
405+ trace!( "Using sync protocol v2 for {}" , url) ;
400406 return Builder :: new_synced_database( path, url, auth_token)
401407 . remote_writes( true )
402408 . read_your_writes( read_your_writes)
403409 . build( )
404410 . await ;
405411 }
406-
412+ trace!( "Using sync protocol v1 for {} based on probe results" , url) ;
413+ }
414+ SyncProtocol :: V1 => {
415+ trace!( "Using sync protocol v1 for {}" , url) ;
407416 }
408- SyncProtocol :: V1 => { }
409417 }
410418 }
411419
0 commit comments