diff --git a/doxy_elog.py b/doxy_elog.py index 4a17eb1..ad230c5 100644 --- a/doxy_elog.py +++ b/doxy_elog.py @@ -21,10 +21,10 @@ def create(target, module_name): '*operator<<*', ]) my_module.add_exclude_file([ - 'debug.h', + 'debug.hpp', ]) my_module.add_file_patterns([ - '*.h', + '*.hpp', '*.md', ]) diff --git a/lutin_test-debug.py b/lutin_test-debug.py new file mode 100644 index 0000000..8e9bc40 --- /dev/null +++ b/lutin_test-debug.py @@ -0,0 +1,40 @@ +#!/usr/bin/python +import lutin.module as module +import lutin.tools as tools +import lutin.debug as debug + + +def get_type(): + return "LIBRARY" + +def get_sub_type(): + return "TEST" + +def get_desc(): + return "basic debug log for test" + +def get_licence(): + return "APACHE-2" + +def get_compagny_type(): + return "com" + +def get_compagny_name(): + return "atria-soft" + +def get_maintainer(): + return ["Mr DUPIN Edouard "] + +def create(target, module_name): + my_module = module.Module(__file__, module_name, get_type()) + my_module.add_src_file([ + 'test-debug/debug.cpp' + ]) + my_module.add_header_file([ + 'test-debug/debug.hpp' + ]) + my_module.add_depend('etk') + my_module.add_path(tools.get_current_path(__file__)) + return my_module + + diff --git a/test-debug/debug.cpp b/test-debug/debug.cpp new file mode 100644 index 0000000..46beb20 --- /dev/null +++ b/test-debug/debug.cpp @@ -0,0 +1,13 @@ +/** @file + * @author Edouard DUPIN + * @copyright 2011, Edouard DUPIN, all right reserved + * @license APACHE v2.0 (see license file) + */ + +#include + +int32_t test::getLogId() { + static int32_t g_val = elog::registerInstance("test"); + return g_val; +} + diff --git a/test-debug/debug.hpp b/test-debug/debug.hpp new file mode 100644 index 0000000..757b971 --- /dev/null +++ b/test-debug/debug.hpp @@ -0,0 +1,45 @@ +/** @file + * @author Edouard DUPIN + * @copyright 2011, Edouard DUPIN, all right reserved + * @license APACHE v2.0 (see license file) + */ + +#include + +#pragma once + +#include + +namespace test { + int32_t getLogId(); +}; + +#define TEST_BASE(info,data) ELOG_BASE(test::getLogId(),info,data) + +#define TEST_PRINT(data) TEST_BASE(-1, data) +#define TEST_CRITICAL(data) TEST_BASE(1, data) +#define TEST_ERROR(data) TEST_BASE(2, data) +#define TEST_WARNING(data) TEST_BASE(3, data) +#ifdef DEBUG + #define TEST_INFO(data) TEST_BASE(4, data) + #define TEST_DEBUG(data) TEST_BASE(5, data) + #define TEST_VERBOSE(data) TEST_BASE(6, data) + #define TEST_TODO(data) TEST_BASE(4, "TODO : " << data) +#else + #define TEST_INFO(data) do { } while(false) + #define TEST_DEBUG(data) do { } while(false) + #define TEST_VERBOSE(data) do { } while(false) + #define TEST_TODO(data) do { } while(false) +#endif + +#define TEST_HIDDEN(data) do { } while(false) + +#define TEST_ASSERT(cond,data) \ + do { \ + if (!(cond)) { \ + TEST_CRITICAL(data); \ + assert(!#cond); \ + } \ + } while (0) + +