My Project
debug.hpp
Go to the documentation of this file.
1 
28 #ifndef BSL_DEBUG_HPP
29 #define BSL_DEBUG_HPP
30 
31 #include "details/out_type_alert.hpp"
32 #include "details/out_type_debug.hpp"
33 #include "details/out_type_empty.hpp"
34 #include "details/out_type_error.hpp"
35 #include "details/out_type_print.hpp"
36 #include "details/out.hpp"
37 
38 #include "char_type.hpp"
39 #include "conditional.hpp"
40 #include "cstdint.hpp"
41 #include "fmt.hpp"
42 
43 namespace bsl
44 {
46  constexpr bsl::uintmax v{1U};
48  constexpr bsl::uintmax vv{2U};
50  constexpr bsl::uintmax vvv{3U};
51 
53  constexpr bsl::char_type endl{'\n'};
54 
56  template<bsl::uintmax DL, typename T>
57  using out_t = conditional_t<DL <= BSL_DEBUG_LEVEL, out<T>, out<details::out_type_empty>>;
58 
71  [[nodiscard]] constexpr out<details::out_type_print>
72  print() noexcept
73  {
74  return {};
75  }
76 
89  template<bsl::uintmax DL = 0>
90  [[nodiscard]] constexpr out_t<DL, details::out_type_debug>
91  debug() noexcept
92  {
93  return {};
94  }
95 
108  template<bsl::uintmax DL = 0>
109  [[nodiscard]] constexpr out_t<DL, details::out_type_alert>
110  alert() noexcept
111  {
112  return {};
113  }
114 
127  [[nodiscard]] constexpr out<details::out_type_error>
128  error() noexcept
129  {
130  return {};
131  }
132 }
133 
134 #endif
typename conditional< B, T, F >::type conditional_t
a helper that reduces the verbosity of bsl::conditional
Definition: conditional.hpp:54
constexpr out< details::out_type_print > print() noexcept
Returns and instance of bsl::out<T>. This version of bsl::out<T> does not print a label and does not ...
Definition: debug.hpp:72
constexpr bsl::uintmax v
defines "-v" verbose mode
Definition: debug.hpp:46
conditional_t< DL<=BSL_DEBUG_LEVEL, out< T >, out< details::out_type_empty > > out_t
used to disable debugging for debug() and alert()
Definition: debug.hpp:57
constexpr bsl::uintmax vvv
defines "-vvv" verbose mode
Definition: debug.hpp:50
constexpr bsl::char_type endl
newline constant
Definition: debug.hpp:53
constexpr out_t< DL, details::out_type_debug > debug() noexcept
Returns and instance of bsl::out<T>. This version of bsl::out<T> prints "DEBUG: " when created and ac...
Definition: debug.hpp:91
constexpr bsl::uintmax vv
defines "-vv" verbose mode
Definition: debug.hpp:48
constexpr out_t< DL, details::out_type_alert > alert() noexcept
Returns and instance of bsl::out<T>. This version of bsl::out<T> prints "ALERT: " when created and ac...
Definition: debug.hpp:110
char char_type
Standard Char Type.
Definition: char_type.hpp:41
constexpr out< details::out_type_error > error() noexcept
Returns and instance of bsl::out<T>. This version of bsl::out<T> prints "ERROR: " when created and do...
Definition: debug.hpp:128
::uintmax_t uintmax
defines a unsigned integer with the maximum possible size
Definition: cstdint.hpp:97