@@ -17,7 +17,7 @@ use tokio::signal::unix::SignalKind;
1717use hyper:: server:: conn:: http1;
1818use hyper_util:: rt:: TokioIo ;
1919
20- use log:: error;
20+ use log:: { error, info , warn } ;
2121
2222use api:: auth:: { Authorizer , NoopAuthorizer } ;
2323use api:: kv_store:: KvStore ;
@@ -52,7 +52,7 @@ fn main() {
5252 let runtime = match tokio:: runtime:: Builder :: new_multi_thread ( ) . enable_all ( ) . build ( ) {
5353 Ok ( runtime) => Arc :: new ( runtime) ,
5454 Err ( e) => {
55- eprintln ! ( "Failed to setup tokio runtime: {}" , e) ;
55+ error ! ( "Failed to setup tokio runtime: {}" , e) ;
5656 std:: process:: exit ( -1 ) ;
5757 } ,
5858 } ;
@@ -62,15 +62,15 @@ fn main() {
6262 let mut sighup_stream = match tokio:: signal:: unix:: signal ( SignalKind :: hangup ( ) ) {
6363 Ok ( stream) => stream,
6464 Err ( e) => {
65- eprintln ! ( "Failed to register SIGHUP handler: {e}" ) ;
65+ error ! ( "Failed to register SIGHUP handler: {e}" ) ;
6666 std:: process:: exit ( -1 ) ;
6767 }
6868 } ;
6969
7070 let mut sigterm_stream = match tokio:: signal:: unix:: signal ( SignalKind :: terminate ( ) ) {
7171 Ok ( stream) => stream,
7272 Err ( e) => {
73- println ! ( "Failed to register for SIGTERM stream: {}" , e) ;
73+ error ! ( "Failed to register for SIGTERM stream: {}" , e) ;
7474 std:: process:: exit ( -1 ) ;
7575 } ,
7676 } ;
@@ -81,11 +81,11 @@ fn main() {
8181 if let Some ( rsa_pem) = config. rsa_pem {
8282 authorizer = match JWTAuthorizer :: new ( & rsa_pem) . await {
8383 Ok ( auth) => {
84- println ! ( "Configured JWT authorizer with RSA public key" ) ;
84+ info ! ( "Configured JWT authorizer with RSA public key" ) ;
8585 Some ( Arc :: new ( auth) )
8686 } ,
8787 Err ( e) => {
88- println ! ( "Failed to configure JWT authorizer: {}" , e) ;
88+ error ! ( "Failed to configure JWT authorizer: {}" , e) ;
8989 std:: process:: exit ( -1 ) ;
9090 } ,
9191 } ;
@@ -94,14 +94,14 @@ fn main() {
9494 #[ cfg( feature = "sigs" ) ]
9595 {
9696 if authorizer. is_none ( ) {
97- println ! ( "Configured signature-validating authorizer" ) ;
97+ info ! ( "Configured signature-validating authorizer" ) ;
9898 authorizer = Some ( Arc :: new ( SignatureValidatingAuthorizer ) ) ;
9999 }
100100 }
101101 let authorizer = if let Some ( auth) = authorizer {
102102 auth
103103 } else {
104- println ! ( "No authentication method configured, all storage with the same store id will be commingled." ) ;
104+ warn ! ( "No authentication method configured, all storage with the same store id will be commingled." ) ;
105105 Arc :: new ( NoopAuthorizer { } )
106106 } ;
107107
@@ -114,10 +114,10 @@ fn main() {
114114 )
115115 . await
116116 . unwrap_or_else ( |e| {
117- println ! ( "Failed to start postgres TLS backend: {}" , e) ;
117+ error ! ( "Failed to start postgres TLS backend: {}" , e) ;
118118 std:: process:: exit ( -1 ) ;
119119 } ) ;
120- println ! (
120+ info ! (
121121 "Connected to PostgreSQL TLS backend with DSN: {}/{}" ,
122122 config. postgresql_prefix, config. vss_db
123123 ) ;
@@ -130,21 +130,21 @@ fn main() {
130130 )
131131 . await
132132 . unwrap_or_else ( |e| {
133- println ! ( "Failed to start postgres plaintext backend: {}" , e) ;
133+ error ! ( "Failed to start postgres plaintext backend: {}" , e) ;
134134 std:: process:: exit ( -1 ) ;
135135 } ) ;
136- println ! (
136+ info ! (
137137 "Connected to PostgreSQL plaintext backend with DSN: {}/{}" ,
138138 config. postgresql_prefix, config. vss_db
139139 ) ;
140140 Arc :: new ( postgres_plaintext_backend)
141141 } ;
142142
143143 let rest_svc_listener = TcpListener :: bind ( & config. bind_address ) . await . unwrap_or_else ( |e| {
144- println ! ( "Failed to bind listening port: {}" , e) ;
144+ error ! ( "Failed to bind listening port: {}" , e) ;
145145 std:: process:: exit ( -1 ) ;
146146 } ) ;
147- println ! ( "Listening for incoming connections on {}{}" , config. bind_address, crate :: vss_service:: BASE_PATH_PREFIX ) ;
147+ info ! ( "Listening for incoming connections on {}{}" , config. bind_address, crate :: vss_service:: BASE_PATH_PREFIX ) ;
148148
149149 loop {
150150 tokio:: select! {
@@ -155,15 +155,15 @@ fn main() {
155155 let vss_service = VssService :: new( Arc :: clone( & store) , Arc :: clone( & authorizer) ) ;
156156 runtime. spawn( async move {
157157 if let Err ( err) = http1:: Builder :: new( ) . serve_connection( io_stream, vss_service) . await {
158- eprintln !( "Failed to serve connection: {}" , err) ;
158+ warn !( "Failed to serve connection: {}" , err) ;
159159 }
160160 } ) ;
161161 } ,
162- Err ( e) => eprintln !( "Failed to accept connection: {}" , e) ,
162+ Err ( e) => warn !( "Failed to accept connection: {}" , e) ,
163163 }
164164 }
165165 _ = tokio:: signal:: ctrl_c( ) => {
166- println !( "Received CTRL-C, shutting down.." ) ;
166+ info !( "Received CTRL-C, shutting down.." ) ;
167167 break ;
168168 }
169169 _ = sighup_stream. recv( ) => {
@@ -172,7 +172,7 @@ fn main() {
172172 }
173173 }
174174 _ = sigterm_stream. recv( ) => {
175- println !( "Received SIGTERM, shutting down.." ) ;
175+ info !( "Received SIGTERM, shutting down.." ) ;
176176 break ;
177177 }
178178 }
0 commit comments