Clover icon

sunshower-core

  1. Project Clover database Fri Apr 6 2018 03:27:42 UTC
  2. Package io.sunshower.service.task.exec

File RxTaskLogger.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart6.png
31% of files have more coverage

Code metrics

0
5
5
1
37
29
5
1
1
5
1

Classes

Class Line # Actions
RxTaskLogger 10 5 5
0.660%
 

Contributing tests

This file is covered by 14 tests. .

Source view

1    package io.sunshower.service.task.exec;
2   
3    import io.reactivex.Observer;
4    import io.reactivex.subjects.PublishSubject;
5    import io.reactivex.subjects.Subject;
6    import io.sunshower.service.model.task.TaskEvent;
7    import io.sunshower.service.model.task.TaskLogger;
8    import java.util.logging.Level;
9   
 
10    class RxTaskLogger implements TaskLogger {
11   
12    final Subject<TaskEvent> subject;
13   
 
14  23 toggle public RxTaskLogger(ParallelTaskExecutor.ParallelTask parallelTask) {
15  23 subject = PublishSubject.create();
16    }
17   
 
18  287 toggle @Override
19    public void infof(String msg, Object... args) {
20  290 subject.onNext(new TaskLogEvent(Level.INFO, String.format(msg, args)));
21    }
22   
 
23  0 toggle @Override
24    public void warnf(String fmt, Object... args) {
25  0 subject.onNext(new TaskLogEvent(Level.WARNING, String.format(fmt, args)));
26    }
27   
 
28  0 toggle @Override
29    public void logf(Level level, String fmt, Object... args) {
30  0 subject.onNext(new TaskLogEvent(Level.INFO, String.format(fmt, args)));
31    }
32   
 
33  10 toggle @Override
34    public void subscribe(Observer<? super TaskEvent> observer) {
35  10 subject.subscribe(observer);
36    }
37    }