[DEV] change log system
This commit is contained in:
parent
9b55657ef1
commit
55e1d5db4b
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
etk::CCout& operator <<(etk::CCout& _os, const airtaudio::api::type& _obj){
|
std::ostream& operator <<(std::ostream& _os, const airtaudio::api::type& _obj){
|
||||||
switch (_obj) {
|
switch (_obj) {
|
||||||
default:
|
default:
|
||||||
case airtaudio::api::UNSPECIFIED: _os << "UNSPECIFIED"; break;
|
case airtaudio::api::UNSPECIFIED: _os << "UNSPECIFIED"; break;
|
||||||
|
@ -191,6 +191,6 @@ namespace airtaudio {
|
|||||||
/**
|
/**
|
||||||
* @brief Debug operator To display the curent element in a Human redeable information
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
*/
|
*/
|
||||||
etk::CCout& operator <<(etk::CCout& _os, const airtaudio::api::type& _obj);
|
std::ostream& operator <<(std::ostream& _os, const airtaudio::api::type& _obj);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
#include <airtaudio/base.h>
|
#include <airtaudio/base.h>
|
||||||
|
|
||||||
etk::CCout& airtaudio::operator <<(etk::CCout& _os, enum errorType _obj) {
|
std::ostream& airtaudio::operator <<(std::ostream& _os, enum errorType _obj) {
|
||||||
switch(_obj) {
|
switch(_obj) {
|
||||||
case errorNone:
|
case errorNone:
|
||||||
_os << "errorNone";
|
_os << "errorNone";
|
||||||
@ -35,7 +35,7 @@ etk::CCout& airtaudio::operator <<(etk::CCout& _os, enum errorType _obj) {
|
|||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::CCout& airtaudio::operator <<(etk::CCout& _os, const airtaudio::format& _obj) {
|
std::ostream& airtaudio::operator <<(std::ostream& _os, const airtaudio::format& _obj) {
|
||||||
switch(_obj) {
|
switch(_obj) {
|
||||||
case SINT8:
|
case SINT8:
|
||||||
_os << "SINT8";
|
_os << "SINT8";
|
||||||
@ -62,7 +62,7 @@ etk::CCout& airtaudio::operator <<(etk::CCout& _os, const airtaudio::format& _ob
|
|||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::CCout& airtaudio::operator <<(etk::CCout& _os, const airtaudio::streamFlags& _obj) {
|
std::ostream& airtaudio::operator <<(std::ostream& _os, const airtaudio::streamFlags& _obj) {
|
||||||
switch(_obj) {
|
switch(_obj) {
|
||||||
case NONINTERLEAVED:
|
case NONINTERLEAVED:
|
||||||
_os << "NONINTERLEAVED";
|
_os << "NONINTERLEAVED";
|
||||||
@ -86,7 +86,7 @@ etk::CCout& airtaudio::operator <<(etk::CCout& _os, const airtaudio::streamFlags
|
|||||||
return _os;
|
return _os;
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::CCout& airtaudio::operator <<(etk::CCout& _os, const airtaudio::streamStatus& _obj) {
|
std::ostream& airtaudio::operator <<(std::ostream& _os, const airtaudio::streamStatus& _obj) {
|
||||||
switch(_obj) {
|
switch(_obj) {
|
||||||
case INPUT_OVERFLOW:
|
case INPUT_OVERFLOW:
|
||||||
_os << "INPUT_OVERFLOW";
|
_os << "INPUT_OVERFLOW";
|
||||||
|
@ -39,7 +39,7 @@ namespace airtaudio {
|
|||||||
/**
|
/**
|
||||||
* @brief Debug operator To display the curent element in a Human redeable information
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
*/
|
*/
|
||||||
//etk::CCout& operator <<(etk::CCout& _os, enum errorType _obj);
|
//std::ostream& operator <<(std::ostream& _os, enum errorType _obj);
|
||||||
/**
|
/**
|
||||||
* @typedef typedef uint64_t format;
|
* @typedef typedef uint64_t format;
|
||||||
* @brief airtaudio data format type.
|
* @brief airtaudio data format type.
|
||||||
@ -68,7 +68,7 @@ namespace airtaudio {
|
|||||||
/**
|
/**
|
||||||
* @brief Debug operator To display the curent element in a Human redeable information
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
*/
|
*/
|
||||||
//etk::CCout& operator <<(etk::CCout& _os, const airtaudio::format& _obj);
|
//std::ostream& operator <<(std::ostream& _os, const airtaudio::format& _obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef typedef uint64_t streamFlags;
|
* @typedef typedef uint64_t streamFlags;
|
||||||
@ -123,7 +123,7 @@ namespace airtaudio {
|
|||||||
/**
|
/**
|
||||||
* @brief Debug operator To display the curent element in a Human redeable information
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
*/
|
*/
|
||||||
//etk::CCout& operator <<(etk::CCout& _os, const airtaudio::streamFlags& _obj);
|
//std::ostream& operator <<(std::ostream& _os, const airtaudio::streamFlags& _obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef typedef uint64_t rtaudio::streamStatus;
|
* @typedef typedef uint64_t rtaudio::streamStatus;
|
||||||
@ -144,7 +144,7 @@ namespace airtaudio {
|
|||||||
/**
|
/**
|
||||||
* @brief Debug operator To display the curent element in a Human redeable information
|
* @brief Debug operator To display the curent element in a Human redeable information
|
||||||
*/
|
*/
|
||||||
//etk::CCout& operator <<(etk::CCout& _os, const airtaudio::streamStatus& _obj);
|
//std::ostream& operator <<(std::ostream& _os, const airtaudio::streamStatus& _obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief RtAudio callback function prototype.
|
* @brief RtAudio callback function prototype.
|
||||||
|
@ -8,5 +8,7 @@
|
|||||||
|
|
||||||
#include <airtaudio/debug.h>
|
#include <airtaudio/debug.h>
|
||||||
|
|
||||||
const char * airtaudioLibName = "airtaudio";
|
int32_t airtaudio::getLogId(void) {
|
||||||
|
static int32_t g_val = etk::log::registerInstance("airtaudio");
|
||||||
|
return g_val;
|
||||||
|
}
|
||||||
|
@ -9,20 +9,44 @@
|
|||||||
#ifndef __EAUDIOFX_DEBUG_H__
|
#ifndef __EAUDIOFX_DEBUG_H__
|
||||||
#define __EAUDIOFX_DEBUG_H__
|
#define __EAUDIOFX_DEBUG_H__
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/log.h>
|
||||||
#include <etk/debugGeneric.h>
|
|
||||||
|
|
||||||
extern const char * airtaudioLibName;
|
namespace airtaudio {
|
||||||
|
int32_t getLogId(void);
|
||||||
|
};
|
||||||
|
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
|
||||||
|
#define ATA_BASE(info,data) \
|
||||||
|
do { \
|
||||||
|
if (info <= etk::log::getLevel(airtaudio::getLogId())) { \
|
||||||
|
std::stringbuf sb; \
|
||||||
|
std::ostream tmpStream(&sb); \
|
||||||
|
tmpStream << data; \
|
||||||
|
etk::log::logStream(airtaudio::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#define ATA_CRITICAL(data) ETK_CRITICAL(airtaudioLibName, data)
|
#define ATA_CRITICAL(data) ATA_BASE(1, data)
|
||||||
#define ATA_WARNING(data) ETK_WARNING(airtaudioLibName, data)
|
#define ATA_ERROR(data) ATA_BASE(2, data)
|
||||||
#define ATA_ERROR(data) ETK_ERROR(airtaudioLibName, data)
|
#define ATA_WARNING(data) ATA_BASE(3, data)
|
||||||
#define ATA_INFO(data) ETK_INFO(airtaudioLibName, data)
|
#ifdef DEBUG
|
||||||
#define ATA_DEBUG(data) ETK_DEBUG(airtaudioLibName, data)
|
#define ATA_INFO(data) ATA_BASE(4, data)
|
||||||
#define ATA_VERBOSE(data) ETK_VERBOSE(airtaudioLibName, data)
|
#define ATA_DEBUG(data) ATA_BASE(5, data)
|
||||||
#define ATA_ASSERT(cond,data) ETK_ASSERT(airtaudioLibName, cond, data)
|
#define ATA_VERBOSE(data) ATA_BASE(6, data)
|
||||||
#define ATA_CHECK_INOUT(cond) ETK_CHECK_INOUT(airtaudioLibName, cond)
|
#define ATA_TODO(data) ATA_BASE(4, "TODO : " << data)
|
||||||
#define ATA_TODO(cond) ETK_TODO(airtaudioLibName, cond)
|
#else
|
||||||
|
#define ATA_INFO(data) do { } while(false)
|
||||||
|
#define ATA_DEBUG(data) do { } while(false)
|
||||||
|
#define ATA_VERBOSE(data) do { } while(false)
|
||||||
|
#define ATA_TODO(data) do { } while(false)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ATA_ASSERT(cond,data) \
|
||||||
|
do { \
|
||||||
|
if (!(cond)) { \
|
||||||
|
ATA_CRITICAL(data); \
|
||||||
|
assert(!#cond); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user