mirror of
https://github.com/thelsing/knx.git
synced 2025-09-05 17:50:22 +02:00
wip
This commit is contained in:
parent
2d40692a9f
commit
e147e0e72f
@ -7,6 +7,7 @@
|
||||
#include "string.h"
|
||||
#include "bits.h"
|
||||
#include <stdio.h>
|
||||
#include "logger.h"
|
||||
|
||||
const SecurityControl ApplicationLayer::noSecurity {.toolAccess=false, .dataSecurity=DataSecurity::None};
|
||||
|
||||
@ -97,8 +98,9 @@ void ApplicationLayer::dataGroupConfirm(AckType ack, HopCountType hopType, Prior
|
||||
_savedAsapWriteRequest = 0;
|
||||
break;
|
||||
default:
|
||||
print("datagroup-confirm: unhandled APDU-Type: ");
|
||||
println(apdu.type());
|
||||
KNX_LOG_INFO<KNX_LOG_AL>("datagroup-confirm: unhandled APDU-Type: 0x%04x", apdu.type());
|
||||
//print("datagroup-confirm: unhandled APDU-Type: 0x%04x", apdu.type());
|
||||
//println(apdu.type());
|
||||
}
|
||||
}
|
||||
|
||||
|
9
src/knx/logger.cpp
Normal file
9
src/knx/logger.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
void KnxLogger::log(const char* message, va_list& values)
|
||||
{
|
||||
printf(message, values);
|
||||
}
|
||||
|
||||
KnxLogger knxLogger;
|
@ -12,8 +12,21 @@ Usage:
|
||||
|
||||
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
#include <string>
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
|
||||
class KnxLogger
|
||||
{
|
||||
public:
|
||||
void log(const char* message, va_list& values);
|
||||
};
|
||||
|
||||
extern KnxLogger knxLogger;
|
||||
|
||||
|
||||
constexpr uint64_t KNX_LOG_LVL_ERROR = 1;
|
||||
@ -46,26 +59,26 @@ template<uint64_t x, typename... Args>
|
||||
__attribute__((always_inline)) constexpr void KNX_LOG_TRACE(Args&&... args)
|
||||
{
|
||||
if constexpr((LOGLEVEL >= KNX_LOG_LVL_TRACE) && (x & LOGAREAS))
|
||||
printf(std::forward<Args>(args)...);
|
||||
knxLogger.log(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<uint64_t x, typename... Args>
|
||||
__attribute__((always_inline)) constexpr void KNX_LOG_DEBUG(Args&&... args)
|
||||
{
|
||||
if constexpr((LOGLEVEL >= KNX_LOG_LVL_DEBUG) && (x & LOGAREAS))
|
||||
printf(std::forward<Args>(args)...);
|
||||
knxLogger.log(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<uint64_t x, typename... Args>
|
||||
__attribute__((always_inline)) constexpr void KNX_LOG_INFO(Args&&... args)
|
||||
{
|
||||
if constexpr((LOGLEVEL >= KNX_LOG_LVL_INFO) && (x & LOGAREAS))
|
||||
printf(std::forward<Args>(args)...);
|
||||
knxLogger.log(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<uint64_t x, typename... Args>
|
||||
__attribute__((always_inline)) constexpr void KNX_LOG_ERROR(Args&&... args)
|
||||
{
|
||||
if constexpr((LOGLEVEL >= KNX_LOG_LVL_ERROR) && (x & LOGAREAS))
|
||||
printf(std::forward<Args>(args)...);
|
||||
knxLogger.log(std::forward<Args>(args)...);
|
||||
}
|
Loading…
Reference in New Issue
Block a user