[DEV] use doxygen doc generation instead of monk and correct __class__ name
This commit is contained in:
parent
1f4751c3d7
commit
c3ce5a9ebc
15
doxy_elog.py
Normal file
15
doxy_elog.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import os
|
||||||
|
import doxy.module as module
|
||||||
|
import doxy.debug as debug
|
||||||
|
import doxy.tools as tools
|
||||||
|
|
||||||
|
def create(target, module_name):
|
||||||
|
my_module = module.Module(__file__, module_name)
|
||||||
|
my_module.set_version([0,1,"dev"])
|
||||||
|
my_module.set_title("Elog: Etk log interface")
|
||||||
|
my_module.set_website("http://atria-soft.github.io/" + module_name)
|
||||||
|
my_module.set_website_sources("http://github.com/atria-soft/" + module_name)
|
||||||
|
my_module.set_path(os.path.join(tools.get_current_path(__file__), module_name))
|
||||||
|
|
||||||
|
return my_module
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
*
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
*
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
@ -11,6 +11,10 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
namespace elog {
|
namespace elog {
|
||||||
|
/**
|
||||||
|
* @brief Get local id of the library
|
||||||
|
* @return Unique ID of the library
|
||||||
|
*/
|
||||||
int32_t getLogId();
|
int32_t getLogId();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
*
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
*
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
40
elog/log.cpp
40
elog/log.cpp
@ -1,4 +1,4 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
*
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
@ -169,22 +169,22 @@ std::vector<std::string> elog::getListInstance() {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void elog::logStream(int32_t _id, int32_t _level, int32_t _ligne, const char* _className, const char* _funcName, const std::ostream& _log) {
|
void elog::logStream(int32_t _id, int32_t _level, int32_t _ligne, const char* _funcName, const std::ostream& _log) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << _log.rdbuf();
|
oss << _log.rdbuf();
|
||||||
std::string sss =oss.str();
|
std::string sss =oss.str();
|
||||||
elog::logChar(_id, _level, _ligne, _className, _funcName, sss.c_str());
|
elog::logChar(_id, _level, _ligne, _funcName, sss.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void elog::logChar1(int32_t _id, int32_t _level, const char* _log) {
|
void elog::logChar1(int32_t _id, int32_t _level, const char* _log) {
|
||||||
elog::logChar(_id, _level, -1, nullptr, nullptr, _log);
|
elog::logChar(_id, _level, -1, nullptr, _log);
|
||||||
}
|
}
|
||||||
|
|
||||||
void elog::logStream1(int32_t _id, int32_t _level, const std::ostream& _log) {
|
void elog::logStream1(int32_t _id, int32_t _level, const std::ostream& _log) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << _log.rdbuf();
|
oss << _log.rdbuf();
|
||||||
std::string sss =oss.str();
|
std::string sss =oss.str();
|
||||||
elog::logChar(_id, _level, -1, nullptr, nullptr, sss.c_str());
|
elog::logChar(_id, _level, -1, nullptr, sss.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool& getColor() {
|
static bool& getColor() {
|
||||||
@ -292,7 +292,7 @@ static void getDisplayTime(char* data) {
|
|||||||
|
|
||||||
#define LENGHT_MAX_LOG (2048)
|
#define LENGHT_MAX_LOG (2048)
|
||||||
|
|
||||||
void elog::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* _className, const char* _funcName, const char* _log) {
|
void elog::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* _funcName, const char* _log) {
|
||||||
static std::mutex g_lock;
|
static std::mutex g_lock;
|
||||||
char handle[LENGHT_MAX_LOG] = "";
|
char handle[LENGHT_MAX_LOG] = "";
|
||||||
memset(handle, ' ', LENGHT_MAX_LOG);
|
memset(handle, ' ', LENGHT_MAX_LOG);
|
||||||
@ -416,37 +416,33 @@ void elog::logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* _cla
|
|||||||
int32_t len = strlen(handle);
|
int32_t len = strlen(handle);
|
||||||
char tmpName[1024];
|
char tmpName[1024];
|
||||||
char *tmpPointer = tmpName;
|
char *tmpPointer = tmpName;
|
||||||
#ifndef __TARGET_OS__Android
|
|
||||||
if (_className != nullptr) {
|
|
||||||
snprintf(tmpPointer, 1024, "%s::", _className);
|
|
||||||
tmpPointer = tmpPointer+strlen(tmpPointer);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (_funcName != nullptr) {
|
if (_funcName != nullptr) {
|
||||||
#if defined(__TARGET_OS__Android)
|
|
||||||
// cleen for android :
|
// cleen for android :
|
||||||
char* startPos = strchr(_funcName, ' ');
|
char* startPos = strchr((char*)_funcName, ' ');
|
||||||
char* stopPos = strchr(_funcName, '(');
|
char* stopPos = strchr((char*)_funcName, '(');
|
||||||
if (startPos != nullptr) {
|
if (startPos != nullptr) {
|
||||||
if (stopPos != nullptr) {
|
if (stopPos != nullptr) {
|
||||||
if(stopPos < startPos) {
|
char* startPos2 = strchr(startPos+1, ' ');
|
||||||
snprintf(tmpPointer, std::min(1024, int32_t(stopPos-_funcName)), "%s", _funcName);
|
while ( startPos2 != nullptr
|
||||||
|
&& startPos2 < stopPos) {
|
||||||
|
startPos = startPos2;
|
||||||
|
startPos2 = strchr(startPos+1, ' ');
|
||||||
|
}
|
||||||
|
if(uint64_t(stopPos) < uint64_t(startPos)) {
|
||||||
|
snprintf(tmpPointer, std::min(uint64_t(1024), uint64_t(stopPos)-uint64_t(_funcName)), "%s", _funcName);
|
||||||
} else {
|
} else {
|
||||||
snprintf(tmpPointer, std::min(1024, int32_t(stopPos-startPos)), "%s", startPos+1);
|
snprintf(tmpPointer, std::min(uint64_t(1024), uint64_t(stopPos)-uint64_t(startPos)), "%s", startPos+1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
snprintf(tmpPointer, 1024, "%s", startPos);
|
snprintf(tmpPointer, 1024, "%s", startPos);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (stopPos != nullptr) {
|
if (stopPos != nullptr) {
|
||||||
snprintf(tmpPointer, std::min(1024, int32_t(stopPos-_funcName)), "%s", _funcName);
|
snprintf(tmpPointer, std::min(uint64_t(1024), uint64_t(stopPos)-uint64_t(_funcName)+1), "%s", _funcName);
|
||||||
} else {
|
} else {
|
||||||
snprintf(tmpPointer, 1024, "%s", _funcName);
|
snprintf(tmpPointer, 1024, "%s", _funcName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
snprintf(tmpPointer, 1024, "%s", _funcName);
|
|
||||||
#endif
|
|
||||||
tmpPointer = tmpPointer+strlen(tmpPointer);
|
tmpPointer = tmpPointer+strlen(tmpPointer);
|
||||||
}
|
}
|
||||||
size_t lenFunc = strlen(tmpName);
|
size_t lenFunc = strlen(tmpName);
|
||||||
|
46
elog/log.h
46
elog/log.h
@ -1,4 +1,4 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
*
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
@ -34,11 +34,14 @@ namespace elog {
|
|||||||
/**
|
/**
|
||||||
* @brief Set the log level of a specific instance
|
* @brief Set the log level of a specific instance
|
||||||
* @param[in] _name Name of the intance
|
* @param[in] _name Name of the intance
|
||||||
* @param[in] _id Id of the intance
|
|
||||||
* @param[in] _level New level to set on the instance
|
* @param[in] _level New level to set on the instance
|
||||||
*/
|
*/
|
||||||
void setLevel(const std::string& _name, enum level _level);
|
void setLevel(const std::string& _name, enum level _level);
|
||||||
//! @previous
|
/**
|
||||||
|
* @brief Set the log level of a specific instance
|
||||||
|
* @param[in] _id Id of the intance
|
||||||
|
* @param[in] _level New level to set on the instance
|
||||||
|
*/
|
||||||
void setLevel(int32_t _id, enum level _level);
|
void setLevel(int32_t _id, enum level _level);
|
||||||
/**
|
/**
|
||||||
* @brief Set global debug level
|
* @brief Set global debug level
|
||||||
@ -96,27 +99,40 @@ namespace elog {
|
|||||||
* @param[in] _id Id of the instance type
|
* @param[in] _id Id of the instance type
|
||||||
* @param[in] _level Level debug
|
* @param[in] _level Level debug
|
||||||
* @param[in] _ligne Line of the debug
|
* @param[in] _ligne Line of the debug
|
||||||
* @param[in] _className Class name of the debug
|
* @param[in] _funcName Function name for debug (compleate decorate signature)
|
||||||
* @param[in] _funcName Function name for debug
|
* @param[in] _log Stream to log
|
||||||
|
*/
|
||||||
|
void logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* _funcName, const char* _log);
|
||||||
|
/**
|
||||||
|
* @brief Call log to display
|
||||||
|
* @param[in] _id Id of the instance type
|
||||||
|
* @param[in] _level Level debug
|
||||||
|
* @param[in] _ligne Line of the debug
|
||||||
|
* @param[in] _funcName Function name for debug (compleate decorate signature)
|
||||||
|
* @param[in] _log Stream to log
|
||||||
|
*/
|
||||||
|
void logStream(int32_t _id, int32_t _level, int32_t _ligne, const char* _funcName, const std::ostream& _log);
|
||||||
|
/**
|
||||||
|
* @brief Call log to display
|
||||||
|
* @param[in] _id Id of the instance type
|
||||||
|
* @param[in] _level Level debug
|
||||||
* @param[in] _log Stream to log
|
* @param[in] _log Stream to log
|
||||||
*/
|
*/
|
||||||
void logChar(int32_t _id, int32_t _level, int32_t _ligne, const char* _className, const char* _funcName, const char* _log);
|
|
||||||
//! @previous
|
|
||||||
void logStream(int32_t _id, int32_t _level, int32_t _ligne, const char* _className, const char* _funcName, const std::ostream& _log);
|
|
||||||
//! @previous
|
|
||||||
void logChar1(int32_t _id, int32_t _level, const char* _log);
|
void logChar1(int32_t _id, int32_t _level, const char* _log);
|
||||||
//! @previous
|
/**
|
||||||
|
* @brief Call log to display
|
||||||
|
* @param[in] _id Id of the instance type
|
||||||
|
* @param[in] _level Level debug
|
||||||
|
* @param[in] _log Stream to log
|
||||||
|
*/
|
||||||
void logStream1(int32_t _id, int32_t _level, const std::ostream& _log);
|
void logStream1(int32_t _id, int32_t _level, const std::ostream& _log);
|
||||||
/**
|
/**
|
||||||
* @brief Display the current backtrace
|
* @brief Display the current backtrace
|
||||||
* @param[in] _breakAtEnd assert program when backtrace is printed
|
* @param[in] _breakAtEnd assert program when backtrace is printed
|
||||||
|
* @param[in] _removeElement Number of element remove in the stack before display (permit to remove log function call)
|
||||||
*/
|
*/
|
||||||
void displayBacktrace(bool _breakAtEnd = false, int32_t _removeElement=0);
|
void displayBacktrace(bool _breakAtEnd = false, int32_t _removeElement=0);
|
||||||
};
|
};
|
||||||
#ifdef __class__
|
|
||||||
#undef __class__
|
|
||||||
#endif
|
|
||||||
#define __class__ (nullptr)
|
|
||||||
|
|
||||||
// generic define for all logs::
|
// generic define for all logs::
|
||||||
#define ELOG_BASE(logId,info,data) \
|
#define ELOG_BASE(logId,info,data) \
|
||||||
@ -125,6 +141,6 @@ namespace elog {
|
|||||||
std::stringbuf sb; \
|
std::stringbuf sb; \
|
||||||
std::ostream tmpStream(&sb); \
|
std::ostream tmpStream(&sb); \
|
||||||
tmpStream << data; \
|
tmpStream << data; \
|
||||||
elog::logStream(logId, info, __LINE__, __class__, __func__, tmpStream); \
|
elog::logStream(logId, info, __LINE__, __PRETTY_FUNCTION__, tmpStream); \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
*
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/** @file
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
*
|
*
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
Loading…
x
Reference in New Issue
Block a user