@@ -7,7 +7,9 @@ use datafusion::execution::options::{
77} ;
88use datafusion:: prelude:: { SessionConfig , SessionContext } ;
99use datafusion_postgres:: pg_catalog:: setup_pg_catalog;
10- use datafusion_postgres:: { serve, ServerOptions } ; // Assuming the crate name is `datafusion_postgres`
10+ use datafusion_postgres:: { serve, ServerOptions } ;
11+ use env_logger:: Env ;
12+ use log:: info;
1113use structopt:: StructOpt ;
1214
1315#[ derive( Debug , StructOpt ) ]
@@ -129,7 +131,7 @@ async fn setup_session_context(
129131 . register_csv ( table_name, table_path, CsvReadOptions :: default ( ) )
130132 . await
131133 . map_err ( |e| format ! ( "Failed to register CSV table '{table_name}': {e}" ) ) ?;
132- println ! ( "Loaded {table_path} as table {table_name}" ) ;
134+ info ! ( "Loaded {table_path} as table {table_name}" ) ;
133135 }
134136
135137 // Register JSON tables
@@ -138,7 +140,7 @@ async fn setup_session_context(
138140 . register_json ( table_name, table_path, NdJsonReadOptions :: default ( ) )
139141 . await
140142 . map_err ( |e| format ! ( "Failed to register JSON table '{table_name}': {e}" ) ) ?;
141- println ! ( "Loaded {table_path} as table {table_name}" ) ;
143+ info ! ( "Loaded {table_path} as table {table_name}" ) ;
142144 }
143145
144146 // Register Arrow tables
@@ -151,7 +153,7 @@ async fn setup_session_context(
151153 . register_arrow ( table_name, table_path, ArrowReadOptions :: default ( ) )
152154 . await
153155 . map_err ( |e| format ! ( "Failed to register Arrow table '{table_name}': {e}" ) ) ?;
154- println ! ( "Loaded {table_path} as table {table_name}" ) ;
156+ info ! ( "Loaded {table_path} as table {table_name}" ) ;
155157 }
156158
157159 // Register Parquet tables
@@ -164,7 +166,7 @@ async fn setup_session_context(
164166 . register_parquet ( table_name, table_path, ParquetReadOptions :: default ( ) )
165167 . await
166168 . map_err ( |e| format ! ( "Failed to register Parquet table '{table_name}': {e}" ) ) ?;
167- println ! ( "Loaded {table_path} as table {table_name}" ) ;
169+ info ! ( "Loaded {table_path} as table {table_name}" ) ;
168170 }
169171
170172 // Register Avro tables
@@ -173,7 +175,7 @@ async fn setup_session_context(
173175 . register_avro ( table_name, table_path, AvroReadOptions :: default ( ) )
174176 . await
175177 . map_err ( |e| format ! ( "Failed to register Avro table '{table_name}': {e}" ) ) ?;
176- println ! ( "Loaded {table_path} as table {table_name}" ) ;
178+ info ! ( "Loaded {table_path} as table {table_name}" ) ;
177179 }
178180
179181 // Register pg_catalog
@@ -184,7 +186,10 @@ async fn setup_session_context(
184186
185187#[ tokio:: main]
186188async fn main ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
187- env_logger:: init ( ) ;
189+ env_logger:: Builder :: from_env (
190+ Env :: default ( ) . default_filter_or ( "datafusion_postgres=info,,datafusion_postgres_cli=info" ) ,
191+ )
192+ . init ( ) ;
188193
189194 let mut opts = Opt :: from_args ( ) ;
190195 opts. include_directory_files ( ) ?;
0 commit comments