Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Ing-Dom committed Dec 29, 2023
1 parent 485d973 commit 88fe16c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/knx/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*/

#include <utility>


constexpr auto KNX_LOG_LVL_ERROR = 1;
constexpr auto KNX_LOG_LVL_INFO = 2;
Expand Down Expand Up @@ -44,26 +46,26 @@ template<auto x, typename... Args>
__attribute__((always_inline)) constexpr void KNX_LOG_TRACE(Args&&... args)
{
if constexpr((LOGLEVEL >= KNX_LOG_LVL_TRACE) && (x & LOGAREAS))
Serial.printf(std::forward<Args>(args)...);
printf(std::forward<Args>(args)...);
}

template<auto x, typename... Args>
__attribute__((always_inline)) constexpr void KNX_LOG_DEBUG(Args&&... args)
{
if constexpr((LOGLEVEL >= KNX_LOG_LVL_DEBUG) && (x & LOGAREAS))
Serial.printf(std::forward<Args>(args)...);
printf(std::forward<Args>(args)...);
}

template<auto x, typename... Args>
__attribute__((always_inline)) constexpr void KNX_LOG_INFO(Args&&... args)
{
if constexpr((LOGLEVEL >= KNX_LOG_LVL_INFO) && (x & LOGAREAS))
Serial.printf(std::forward<Args>(args)...);
printf(std::forward<Args>(args)...);
}

template<auto x, typename... Args>
__attribute__((always_inline)) constexpr void KNX_LOG_ERROR(Args&&... args)
{
if constexpr((LOGLEVEL >= KNX_LOG_LVL_ERROR) && (x & LOGAREAS))
Serial.printf(std::forward<Args>(args)...);
printf(std::forward<Args>(args)...);
}

0 comments on commit 88fe16c

Please sign in to comment.