PageRenderTime 16ms CodeModel.GetById 10ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/tools/errors/liberty_error_levels.e

http://github.com/tybor/Liberty
Specman e | 54 lines | 36 code | 4 blank | 14 comment | 0 complexity | a46f8bb4c36e0a67f9e1114a39d13163 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_ERROR_LEVELS
16
17feature {ANY} -- Error levels
18   level_system_error: INTEGER_8 is -2
19   level_fatal_error: INTEGER_8 is -1
20   level_error: INTEGER_8 is 0
21   level_warning: INTEGER_8 is 1
22   level_info: INTEGER_8 is 2
23   level_verbose: INTEGER_8 is 3
24   level_debug: INTEGER_8 is 4
25
26   valid_level (a_level: INTEGER_8): BOOLEAN is
27      do
28         Result := a_level.in_range(level_system_error, level_debug)
29      end
30
31   level_tag (a_level: INTEGER_8): STRING is
32      require
33         valid_level(a_level)
34      do
35         inspect
36            a_level
37         when level_system_error then
38            Result := once "System error"
39         when level_fatal_error then
40            Result := once "Fatal error"
41         when level_error then
42            Result := once "Error"
43         when level_warning then
44            Result := once "Warning"
45         when level_info then
46            Result := once "Info"
47         when level_verbose then
48            Result := once "More info"
49         when level_debug then
50            Result := once "Debug"
51         end
52      end
53
54end