API Overview API Index Package Overview Direct link to this page
JavaOnTracks 0.1.2
  net.jot.logger. JOTLogFilter View Javadoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

/*
------------------------------------
JavaOnTracks          Thibaut Colar
tcolar-jot AT colar DOT net
Artistic Licence 2.0
http://www.javaontracks.net
------------------------------------
 */

package net.jot.logger;

import java.util.Vector;

/**
 * An implementation of a TailFilter to retrieve only the "valid" log lines
 * It only accept the lines coreponding to the given log level.
 *
 *@author     tcolar
 *@created    May 6, 2003
 */
public class JOTLogFilter implements JOTTailFilter
{
    Vector levels;


    /**
     *@param  logLevels  Description of Parameter
     */
    public JOTLogFilter(Vector logLevels)
    {
        levels = logLevels;
    }


    /**
     *Description of the Method
     *
     *@param  s  Description of Parameter
     *@return    Description of the Returned Value
     */
    public boolean acceptLine(String s)
    {
    	boolean result=false;
        // check if this line's level matches the wanted levels.
        if (s != null && s.length() > 0)
        {
            String level = s.split(" ")[0];
            //System.out.println("line level: '"+level+"'  VS  "+levels+" "+s);
            result=levels.contains(new Integer(level));
        }
       	//System.out.println("Testing line: "+s+" -> "+result);
        return result;
    }

}

Generated By: JavaOnTracks Doclet 0.1.5     ©Thibaut Colar