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: | 65 |  | Methods: | 6
| NCLOC: | 35 |  | 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
LoggerNameMatchFilter.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 |  |
     /*
6 |  |
      * Created on 2003/11/07
7 |  |
      */
8 |  |
     package org.asyrinx.brownie.log.log4j.varia;
9 |  |
10 |  |
     import org.apache.log4j.spi.Filter;
11 |  |
     import org.apache.log4j.spi.LoggingEvent;
12 |  |
13 |  |
     /**
14 |  |
      * @author akima
15 |  |
      */
16 |  |
     public class LoggerNameMatchFilter extends Filter {
17 |  |
18 |  |
         /**
19 |  |
          *
20 |  |
          */
21 | 0 |
         public LoggerNameMatchFilter() {
22 | 0 |
             super();
23 |  |
         }
24 |  |
25 |  |
         boolean acceptOnMatch = true;
26 |  |
27 |  |
         String stringToMatch;
28 |  |
29 | 0 |
         public void setStringToMatch(String s) {
30 | 0 |
             stringToMatch = s;
31 |  |
         }
32 |  |
33 | 0 |
         public String getStringToMatch() {
34 | 0 |
             return stringToMatch;
35 |  |
         }
36 |  |
37 | 0 |
         public void setAcceptOnMatch(boolean acceptOnMatch) {
38 | 0 |
             this.acceptOnMatch = acceptOnMatch;
39 |  |
         }
40 |  |
41 | 0 |
         public boolean getAcceptOnMatch() {
42 | 0 |
             return acceptOnMatch;
43 |  |
         }
44 |  |
45 |  |
         /**
46 |  |
          * Returns {@link Filter#NEUTRAL}is there is no string match.
47 |  |
          */
48 | 0 |
         public int decide(LoggingEvent event) {
49 | 0 |
             final String loggerName = event.getLoggerName();
50 |  |
51 | 0 |
             if (loggerName == null || stringToMatch == null)
52 | 0 |
                 return Filter.NEUTRAL;
53 |  |
54 | 0 |
             if (loggerName.indexOf(stringToMatch) == -1) {
55 | 0 |
                 return Filter.NEUTRAL;
56 |  |
             } else { // we've got a match
57 | 0 |
                 if (acceptOnMatch) {
58 | 0 |
                     return Filter.ACCEPT;
59 |  |
                 } else {
60 | 0 |
                     return Filter.DENY;
61 |  |
                 }
62 |  |
             }
63 |  |
         }
64 |  |
65 |  |
     }