/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. --
  15. expanded class LIBERTY_MAIN_LOG_LEVEL
  16. feature {ANY}
  17. is_error: BOOLEAN is
  18. do
  19. Result := value = log_error
  20. end
  21. is_warning: BOOLEAN is
  22. do
  23. Result := value = log_warning
  24. end
  25. is_info: BOOLEAN is
  26. do
  27. Result := value = log_info
  28. end
  29. is_trace: BOOLEAN is
  30. do
  31. Result := value = log_trace
  32. end
  33. feature {LIBERTY_MAIN}
  34. valid_arg (arg: STRING): BOOLEAN is
  35. do
  36. inspect
  37. arg
  38. when "error", "warning", "info", "trace" then
  39. Result := True
  40. else
  41. end
  42. end
  43. set (arg: STRING): LIBERTY_MAIN_LOG_LEVEL is
  44. do
  45. inspect
  46. arg
  47. when "error" then
  48. value := log_error
  49. when "warning" then
  50. value := log_warning
  51. when "info" then
  52. value := log_info
  53. when "trace" then
  54. value := log_trace
  55. else
  56. check False end
  57. end
  58. Result := Current
  59. end
  60. feature {}
  61. value: INTEGER_8
  62. log_error: INTEGER_8 is -2
  63. log_warning: INTEGER_8 is -1
  64. log_info: INTEGER_8 is 0
  65. log_trace: INTEGER_8 is 1
  66. invariant
  67. value.in_range(log_error, log_trace)
  68. end -- class LIBERTY_MAIN_LOG_LEVEL