@@ -2,7 +2,6 @@ mod group;
22
33use crate :: cfg:: Config ;
44use group:: Group ;
5- use log:: { debug, info} ;
65use pom:: TestId ;
76use std:: { collections:: HashSet , num:: NonZeroU32 } ;
87use valuer_api:: {
@@ -138,7 +137,7 @@ impl Fiber {
138137 }
139138
140139 fn emit_judgelog ( & mut self ) -> FiberReply {
141- debug ! ( "Emitting {:?} judge log" , self . kind) ;
140+ tracing :: info !( "Emitting {:?} judge log" , self . kind) ;
142141 let is_full = self . groups . iter ( ) . all ( |g| g. is_passed ( ) ) ;
143142 let mut judge_log = JudgeLog {
144143 kind : self . kind ,
@@ -148,7 +147,7 @@ impl Fiber {
148147 score : 0 ,
149148 } ;
150149 for ( i, g) in self . groups . iter ( ) . enumerate ( ) {
151- debug ! ( "extending judge log with group {}" , i) ;
150+ tracing :: debug!( "extending judge log with group {}" , i) ;
152151 g. update_judge_log ( & mut judge_log) ;
153152 }
154153
@@ -159,10 +158,10 @@ impl Fiber {
159158 for & i in & self . active_groups {
160159 let g = & mut self . groups [ i] ;
161160 if let reply @ Some ( _) = g. pop_test ( ) {
162- debug ! ( "group {} returned {}" , i, reply. unwrap( ) ) ;
161+ tracing :: debug!( "group {} returned {}" , i, reply. unwrap( ) ) ;
163162 return reply;
164163 }
165- debug ! ( "group {} is not ready to run yet" , i) ;
164+ tracing :: debug!( "group {} is not ready to run yet" , i) ;
166165 }
167166 None
168167 }
@@ -180,17 +179,18 @@ impl Fiber {
180179 }
181180
182181 pub ( crate ) fn poll ( & mut self ) -> FiberReply {
183- debug ! ( "Fiber {:?}: poll iteration" , self . kind) ;
182+ tracing :: debug!( "Fiber {:?}: poll iteration" , self . kind) ;
184183 if self . finished {
185- debug ! ( "Returning none: already finished" ) ;
184+ tracing :: debug!( "Returning none: already finished" ) ;
186185 return FiberReply :: None ;
187186 }
188187 let cur_live_score = self . current_score ( ) ;
189- debug ! ( "live score: {}" , cur_live_score) ;
188+ tracing :: debug!( "live score: {}" , cur_live_score) ;
190189 if cur_live_score != self . last_live_score {
191- info ! (
190+ tracing :: debug !(
192191 "live score updated: old={}, cur={}" ,
193- self . last_live_score, cur_live_score
192+ self . last_live_score,
193+ cur_live_score
194194 ) ;
195195 self . last_live_score = cur_live_score;
196196 return FiberReply :: LiveScore {
@@ -203,20 +203,20 @@ impl Fiber {
203203 let is_passed = g. is_passed ( ) ;
204204 let is_failed = g. is_failed ( ) ;
205205 if is_passed || is_failed {
206- info ! ( "group {} is finished" , i) ;
206+ tracing :: debug !( "group {} is finished" , i) ;
207207 } else {
208208 new_active_groups. push ( i) ;
209209 }
210210 assert ! ( !( is_passed && is_failed) ) ;
211211 if g. is_passed ( ) {
212- debug ! ( "group {} is passed" , i) ;
212+ tracing :: debug!( "group {} is passed" , i) ;
213213 for group in & mut self . groups {
214214 group. on_group_pass ( i as u32 ) ;
215215 }
216216 } else if g. is_failed ( ) {
217217 let mut queue = vec ! [ i as u32 ] ;
218218 while let Some ( k) = queue. pop ( ) {
219- debug ! ( "group {} is failed" , k) ;
219+ tracing :: debug!( "group {} is failed" , k) ;
220220 for ( j, group) in self . groups . iter_mut ( ) . enumerate ( ) {
221221 if !group. is_waiting ( ) {
222222 continue ;
@@ -231,10 +231,10 @@ impl Fiber {
231231 }
232232 self . active_groups = new_active_groups;
233233 if let Some ( test_id) = self . poll_groups_for_tests ( ) {
234- debug ! ( "got test from groups: {}" , test_id) ;
234+ tracing :: debug!( "got test from groups: {}" , test_id) ;
235235 FiberReply :: Test { test_id }
236236 } else if self . running_tests ( ) == 0 {
237- debug ! (
237+ tracing :: debug!(
238238 "this fiber is finished, emitting judge log of kind {:?}" ,
239239 self . kind
240240 ) ;
@@ -248,7 +248,7 @@ impl Fiber {
248248 . flatten ( )
249249 . next ( )
250250 . expect ( "unreachable: running_tests() > 0, but no test found" ) ;
251- debug ! (
251+ tracing :: debug!(
252252 "no updates yet, waiting for running tests, incl. {:?}" ,
253253 running_test
254254 ) ;
@@ -259,9 +259,9 @@ impl Fiber {
259259 }
260260
261261 fn add_test ( & mut self , test : TestId , status : & Status ) {
262- debug ! ( "processing status {:?} for test {}" , status, test) ;
262+ tracing :: debug!( "processing status {:?} for test {}" , status, test) ;
263263 if !self . visible_tests . contains ( & test) {
264- debug ! ( "skipping: test is not visible" ) ;
264+ tracing :: debug!( "skipping: test is not visible" ) ;
265265 return ;
266266 }
267267 for g in & mut self . groups {
@@ -289,7 +289,7 @@ mod tests {
289289 }
290290 #[ test]
291291 fn simple ( ) {
292- simple_logger :: SimpleLogger :: new ( ) . init ( ) . ok ( ) ;
292+ crate :: setup_log ( ) ;
293293 let mut f = make_fiber (
294294 "
295295groups:
0 commit comments