KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > protomatter > syslog > util > logging > Level


1 package com.protomatter.syslog.util.logging;
2
3 import java.io.Serializable JavaDoc;
4 import com.protomatter.syslog.Syslog;
5
6 /**
7  * See <TT><a target="_top" HREF="http://java.sun.com/j2se/1.4/docs/api/java/util/logging/Level.html">java.util.logging.Level</A></TT>.
8  */

9 public class Level
10 implements Serializable JavaDoc
11 {
12     public static final Level OFF = new Level("OFF", 0);
13
14     public static final Level SEVERE = new Level("SEVERE", Syslog.ERROR);
15
16     public static final Level WARNING = new Level("WARNING", Syslog.WARNING);
17
18     public static final Level INFO = new Level("INFO", Syslog.INFO);
19
20     public static final Level CONFIG = new Level("CONFIG", Syslog.DEBUG);
21
22     public static final Level FINE = new Level("FINE", Syslog.DEBUG);
23
24     public static final Level FINER = new Level("FINER", Syslog.DEBUG);
25
26     public static final Level FINEST = new Level("FINEST", Syslog.DEBUG);
27
28     public static final Level ALL = new Level("ALL", Syslog.atOrAbove(Syslog.DEBUG));
29
30     private String JavaDoc name = null;
31     private int value = 0;
32
33     private String JavaDoc resourceBundleName = null;
34
35     protected Level(String JavaDoc name, int value)
36     {
37         this(name, value, null);
38     }
39
40     protected Level(String JavaDoc name, int value, String JavaDoc resourceBundleName)
41     {
42         this.name = name;
43         this.value = value;
44         this.resourceBundleName = resourceBundleName;
45     }
46
47     public String JavaDoc getResourceBundleName()
48     {
49         return this.resourceBundleName;
50     }
51
52     public String JavaDoc getName()
53     {
54         return this.name;
55     }
56
57     public String JavaDoc getLocalizedName()
58     {
59         return this.name;
60     }
61
62     public final String JavaDoc toString()
63     {
64         return "Level[name=" + name + ", value=" + value + "]";
65     }
66
67     public final int intValue()
68     {
69         return value;
70     }
71
72     public static synchronized Level parse(String JavaDoc name)
73     throws IllegalArgumentException JavaDoc
74     {
75         if (name == null)
76         {
77             // should throw NullPointerException
78
}
79
80         if ("OFF".equals(name))
81             return OFF;
82         else if ("SEVERE".equals(name))
83             return SEVERE;
84         else if ("WARNING".equals(name))
85             return WARNING;
86         else if ("INFO".equals(name))
87             return INFO;
88         else if ("CONFIG".equals(name))
89             return CONFIG;
90         else if ("FINE".equals(name))
91             return FINE;
92         else if ("FINER".equals(name))
93             return FINER;
94         else if ("FINEST".equals(name))
95             return FINEST;
96         else if ("ALL".equals(name))
97             return ALL;
98
99         throw new IllegalArgumentException JavaDoc();
100     }
101 }
102
Popular Tags