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