@@ -13,6 +13,7 @@ use narwhal_node::NodeStorage;
13
13
use sui_protocol_config:: { Chain , ProtocolConfig , ProtocolVersion } ;
14
14
use tokio:: sync:: Mutex ;
15
15
use tokio:: time:: Instant ;
16
+ use tracing:: { debug, error, trace, warn} ;
16
17
17
18
use crate :: validator:: Validator ;
18
19
@@ -114,23 +115,23 @@ impl NarwhalService {
114
115
{
115
116
let mut status = self . status . lock ( ) . await ;
116
117
if * status == Status :: Running {
117
- println ! ( "NarwhalService is already running." ) ;
118
+ error ! ( "NarwhalService is already running." ) ;
118
119
return ;
119
120
}
120
121
121
122
let name = self . arguments . primary_keypair . public ( ) . clone ( ) ;
122
123
let execution_state = Arc :: new ( state) ;
123
124
124
125
let epoch = self . committee . epoch ( ) ;
125
- println ! ( "Starting NarwhalService for epoch {epoch}" ) ;
126
+ debug ! ( "Starting NarwhalService for epoch {epoch}" ) ;
126
127
127
128
// create the network client the primary and worker use to communicate
128
129
let network_client =
129
130
NetworkClient :: new_from_keypair ( & self . arguments . primary_network_keypair ) ;
130
131
131
132
let mut running = false ;
132
133
for i in 0 ..MAX_RETRIES {
133
- println ! ( "Trying to start the Narwhal Primary..." ) ;
134
+ debug ! ( "Trying to start the Narwhal Primary..." ) ;
134
135
if i > 0 {
135
136
tokio:: time:: sleep ( tokio:: time:: Duration :: from_secs ( 1 ) ) . await ;
136
137
}
@@ -149,7 +150,7 @@ impl NarwhalService {
149
150
)
150
151
. await
151
152
{
152
- println ! ( "Unable to start Narwhal Primary: {e:?}" ) ;
153
+ warn ! ( "Unable to start Narwhal Primary: {e:?}" ) ;
153
154
} else {
154
155
running = true ;
155
156
break ;
@@ -161,7 +162,7 @@ impl NarwhalService {
161
162
162
163
let mut running = false ;
163
164
for i in 0 ..MAX_RETRIES {
164
- println ! ( "Trying to start the Narwhal Worker..." ) ;
165
+ debug ! ( "Trying to start the Narwhal Worker..." ) ;
165
166
if i > 0 {
166
167
tokio:: time:: sleep ( tokio:: time:: Duration :: from_secs ( 1 ) ) . await ;
167
168
}
@@ -180,7 +181,7 @@ impl NarwhalService {
180
181
)
181
182
. await
182
183
{
183
- println ! ( "Unable to start Narwhal Worker: {e:?}" ) ;
184
+ warn ! ( "Unable to start Narwhal Worker: {e:?}" ) ;
184
185
} else {
185
186
running = true ;
186
187
break ;
@@ -198,18 +199,18 @@ impl NarwhalService {
198
199
pub async fn shutdown ( & self ) {
199
200
let mut status = self . status . lock ( ) . await ;
200
201
if * status == Status :: Stopped {
201
- println ! ( "Narwhal shutdown was called but node is not running." ) ;
202
+ error ! ( "Narwhal shutdown was called but node is not running." ) ;
202
203
return ;
203
204
}
204
205
205
206
let now = Instant :: now ( ) ;
206
207
let epoch = self . committee . epoch ( ) ;
207
- println ! ( "Shutting down Narwhal epoch {epoch:?}" ) ;
208
+ trace ! ( "Shutting down Narwhal epoch {epoch:?}" ) ;
208
209
209
210
self . worker_node . shutdown ( ) . await ;
210
211
self . primary . shutdown ( ) . await ;
211
212
212
- println ! (
213
+ debug ! (
213
214
"Narwhal shutdown for epoch {:?} is complete - took {} seconds" ,
214
215
epoch,
215
216
now. elapsed( ) . as_secs_f64( )
0 commit comments