PageRenderTime 21ms CodeModel.GetById 18ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/tools/main/liberty_main_log_level.e

http://github.com/tybor/Liberty
Specman e | 78 lines | 54 code | 10 blank | 14 comment | 0 complexity | e774499119d6c81c7a341770ab1d9fe2 MD5 | raw file
 1-- This file is part of Liberty Eiffel.
 2--
 3-- Liberty Eiffel is free software: you can redistribute it and/or modify
 4-- it under the terms of the GNU General Public License as published by
 5-- the Free Software Foundation, version 3 of the License.
 6--
 7-- Liberty Eiffel is distributed in the hope that it will be useful,
 8-- but WITHOUT ANY WARRANTY; without even the implied warranty of
 9-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10-- GNU General Public License for more details.
11--
12-- You should have received a copy of the GNU General Public License
13-- along with Liberty Eiffel.  If not, see <http://www.gnu.org/licenses/>.
14--
15expanded class LIBERTY_MAIN_LOG_LEVEL
16
17feature {ANY}
18   is_error: BOOLEAN is
19      do
20         Result := value = log_error
21      end
22
23   is_warning: BOOLEAN is
24      do
25         Result := value = log_warning
26      end
27
28   is_info: BOOLEAN is
29      do
30         Result := value = log_info
31      end
32
33   is_trace: BOOLEAN is
34      do
35         Result := value = log_trace
36      end
37
38feature {LIBERTY_MAIN}
39   valid_arg (arg: STRING): BOOLEAN is
40      do
41         inspect
42            arg
43         when "error", "warning", "info", "trace" then
44            Result := True
45         else
46         end
47      end
48
49   set (arg: STRING): LIBERTY_MAIN_LOG_LEVEL is
50      do
51         inspect
52            arg
53         when "error" then
54            value := log_error
55         when "warning" then
56            value := log_warning
57         when "info" then
58            value := log_info
59         when "trace" then
60            value := log_trace
61         else
62            check False end
63         end
64         Result := Current
65      end
66
67feature {}
68   value: INTEGER_8
69
70   log_error: INTEGER_8 is -2
71   log_warning: INTEGER_8 is -1
72   log_info: INTEGER_8 is 0
73   log_trace: INTEGER_8 is 1
74
75invariant
76   value.in_range(log_error, log_trace)
77
78end -- class LIBERTY_MAIN_LOG_LEVEL