Clover coverage report - brownies library - 1.0-beta-1 Coverage timestamp: 月 8 16 2004 17:14:42 GMT+09:00 FRAMES NO FRAMES |
file stats: | LOC: | 84 |  | Methods: | 6
| NCLOC: | 41 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
MeasureLogImpl.java | 0% | 0% | 0% | 0% |

1 |  |
     /*
2 |  |
      * Joey and its relative products are published under the terms
3 |  |
      * of the Apache Software License.
4 |  |
      */
5 |  |
     package org.asyrinx.brownie.core.log;
6 |  |
7 |  |
     import org.apache.commons.logging.Log;
8 |  |
     import org.apache.commons.logging.LogFactory;
9 |  |
10 |  |
     /**
11 |  |
      * MeasureLogインタフェースの実装です。 reset/doneが行われた時刻から処理時間を計算し、
12 |  |
      * 出力先としてしていされたLoggerに対して時間(ミリ秒)とメッセージを出力します。 <br>
13 |  |
      * 出力先指定されない場合は勝手に生成されます。
14 |  |
      *
15 |  |
      * @author Akima
16 |  |
      */
17 |  |
     public class MeasureLogImpl implements MeasureLog {
18 |  |
19 |  |
         /**
20 |  |
          * Constructor for MeasureLogImpl.
21 |  |
          */
22 | 0 |
         public MeasureLogImpl(String caption) {
23 | 0 |
             this(caption, null);
24 |  |
         }
25 |  |
26 |  |
         /**
27 |  |
          * Constructor for MeasureLogImpl.
28 |  |
          */
29 | 0 |
         public MeasureLogImpl(String caption, Log log) {
30 | 0 |
             this(caption, log, (LogLevel) null);
31 |  |
         }
32 |  |
33 |  |
         /**
34 |  |
          * Constructor for MeasureLogImpl.
35 |  |
          */
36 | 0 |
         public MeasureLogImpl(String caption, Log log, String level) {
37 | 0 |
             this(caption, log, LogLevel.findByName(level));
38 |  |
         }
39 |  |
40 |  |
         /**
41 |  |
          * Constructor for MeasureLogImpl.
42 |  |
          */
43 | 0 |
         public MeasureLogImpl(String caption, Log log, LogLevel level) {
44 | 0 |
             super();
45 | 0 |
             this.caption = caption;
46 | 0 |
             if (log == null)
47 | 0 |
                 log = LogFactory.getLog(this.getClass());
48 | 0 |
             if (level == null)
49 | 0 |
                 level = LogLevel.DEBUG;
50 | 0 |
             this.level = level;
51 | 0 |
             this.log = log;
52 |  |
         }
53 |  |
54 |  |
         private final Log log;
55 |  |
56 |  |
         private final LogLevel level;
57 |  |
58 |  |
         private final String caption;
59 |  |
60 |  |
         private long startedTime = 0;
61 |  |
62 |  |
         /**
63 |  |
          * @see org.asyrinx.log.MeasureLog#begin()
64 |  |
          */
65 | 0 |
         public void reset() {
66 | 0 |
             startedTime = System.currentTimeMillis();
67 |  |
         }
68 |  |
69 |  |
         /**
70 |  |
          * @see org.asyrinx.log.MeasureLog#end()
71 |  |
          */
72 | 0 |
         public void done(String message) {
73 | 0 |
             final StringBuffer msg = new StringBuffer();
74 | 0 |
             msg.append("[measure");
75 | 0 |
             msg.append(":");
76 | 0 |
             msg.append(caption);
77 | 0 |
             msg.append("] ");
78 | 0 |
             msg.append(message);
79 | 0 |
             msg.append(" -- ");
80 | 0 |
             msg.append(String.valueOf(System.currentTimeMillis() - startedTime));
81 | 0 |
             level.write(log, msg.toString());
82 |  |
         }
83 |  |
84 |  |
     }