Modified: incubator/celix/trunk/framework/private/src/wire.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/wire.c?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/src/wire.c (original) +++ incubator/celix/trunk/framework/private/src/wire.c Tue Jan 14 09:21:53 2014 @@ -58,7 +58,7 @@ celix_status_t wire_create(apr_pool_t *p } } - framework_logIfError(status, NULL, "Cannot create wire"); + framework_logIfError(logger, status, NULL, "Cannot create wire"); return status; }
Modified: incubator/celix/trunk/framework/private/test/attribute_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/attribute_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/attribute_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/attribute_test.cpp Tue Jan 14 09:21:53 2014 @@ -33,6 +33,9 @@ extern "C" { #include "attribute_private.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -45,6 +48,9 @@ TEST_GROUP(attribute) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { Modified: incubator/celix/trunk/framework/private/test/bundle_cache_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/bundle_cache_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/bundle_cache_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/bundle_cache_test.cpp Tue Jan 14 09:21:53 2014 @@ -34,6 +34,9 @@ extern "C" { #include <apr_file_io.h> #include "bundle_cache_private.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -46,6 +49,9 @@ TEST_GROUP(bundle_cache) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { @@ -64,7 +70,7 @@ TEST(bundle_cache, create) { .andReturnValue((char *) NULL); bundle_cache_pt cache = NULL; - celix_status_t status = bundleCache_create(configuration, pool, &cache); + celix_status_t status = bundleCache_create(configuration, pool, logger, &cache); LONGS_EQUAL(CELIX_SUCCESS, status); } @@ -127,6 +133,7 @@ TEST(bundle_cache, createArchive) { char location[] = "test.zip"; bundle_archive_pt archive = (bundle_archive_pt) 0x10; mock().expectOneCall("bundleArchive_create") + .withParameter("logger", (void *) NULL) .withParameter("archiveRoot", archiveRoot) .withParameter("id", id) .withParameter("location", location) Modified: incubator/celix/trunk/framework/private/test/bundle_context_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/bundle_context_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/bundle_context_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/bundle_context_test.cpp Tue Jan 14 09:21:53 2014 @@ -33,6 +33,9 @@ extern "C" { #include "bundle_context_private.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -45,6 +48,9 @@ TEST_GROUP(bundle_context) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { @@ -64,7 +70,7 @@ TEST(bundle_context, create) { .andReturnValue(CELIX_SUCCESS); bundle_context_pt context = NULL; - bundleContext_create(framework, bundle, &context); + bundleContext_create(framework, logger, bundle, &context); POINTERS_EQUAL(framework, context->framework) POINTERS_EQUAL(bundle, context->bundle) CHECK(context->pool); Modified: incubator/celix/trunk/framework/private/test/bundle_revision_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/bundle_revision_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/bundle_revision_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/bundle_revision_test.cpp Tue Jan 14 09:21:53 2014 @@ -33,6 +33,9 @@ extern "C" { #include "bundle_revision_private.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -45,6 +48,9 @@ TEST_GROUP(bundle_revision) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { @@ -72,7 +78,7 @@ TEST(bundle_revision, create) { .andReturnValue(CELIX_SUCCESS); bundle_revision_pt revision = NULL; - celix_status_t status = bundleRevision_create(pool, root, location, revisionNr, inputFile, &revision); + celix_status_t status = bundleRevision_create(pool, logger, root, location, revisionNr, inputFile, &revision); LONGS_EQUAL(CELIX_SUCCESS, status); LONGS_EQUAL(revisionNr, revision->revisionNr); STRCMP_EQUAL(root, revision->root); @@ -98,7 +104,7 @@ TEST(bundle_revision, createWithInput) { .andReturnValue(CELIX_SUCCESS); bundle_revision_pt revision = NULL; - celix_status_t status = bundleRevision_create(pool, root, location, revisionNr, inputFile, &revision); + celix_status_t status = bundleRevision_create(pool, logger, root, location, revisionNr, inputFile, &revision); LONGS_EQUAL(CELIX_SUCCESS, status); LONGS_EQUAL(revisionNr, revision->revisionNr); STRCMP_EQUAL(root, revision->root); Modified: incubator/celix/trunk/framework/private/test/bundle_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/bundle_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/bundle_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/bundle_test.cpp Tue Jan 14 09:21:53 2014 @@ -33,6 +33,9 @@ extern "C" { #include "bundle_private.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -45,6 +48,9 @@ TEST_GROUP(bundle) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { @@ -58,6 +64,7 @@ TEST(bundle, create) { bundle_archive_pt archive = (bundle_archive_pt) 0x10; mock().expectOneCall("bundleArchive_createSystemBundleArchive") .withParameter("pool", pool) + .withParameter("logger", logger) .andOutputParameter("bundle_archive", archive) .andReturnValue(CELIX_SUCCESS); @@ -72,7 +79,7 @@ TEST(bundle, create) { .withParameter("module", module); bundle_pt actual = NULL; - celix_status_t status = bundle_create(&actual, pool); + celix_status_t status = bundle_create(&actual, logger, pool); LONGS_EQUAL(CELIX_SUCCESS, status); POINTERS_EQUAL(NULL, actual->context); POINTERS_EQUAL(NULL, actual->activator); Modified: incubator/celix/trunk/framework/private/test/capability_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/capability_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/capability_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/capability_test.cpp Tue Jan 14 09:21:53 2014 @@ -34,6 +34,9 @@ extern "C" { #include "capability_private.h" #include "attribute.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -46,6 +49,9 @@ TEST_GROUP(capability) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { Modified: incubator/celix/trunk/framework/private/test/manifest_parser_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/manifest_parser_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/manifest_parser_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/manifest_parser_test.cpp Tue Jan 14 09:21:53 2014 @@ -33,6 +33,9 @@ extern "C" { #include "manifest_parser.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -45,6 +48,9 @@ TEST_GROUP(manifest_parser) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { Modified: incubator/celix/trunk/framework/private/test/manifest_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/manifest_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/manifest_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/manifest_test.cpp Tue Jan 14 09:21:53 2014 @@ -34,6 +34,9 @@ extern "C" { #include "manifest.h" #include "hash_map.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -46,6 +49,9 @@ TEST_GROUP(manifest) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { @@ -56,7 +62,7 @@ TEST_GROUP(manifest) { }; TEST(manifest, createFromFile) { - char *manifestFile = "../../celix/framework/private/resources-test/manifest.txt"; + char manifestFile[] = "../../celix/framework/private/resources-test/manifest.txt"; manifest_pt manifest = NULL; // properties_pt properties = properties_create(); properties_pt properties = (properties_pt) 0x40; @@ -97,7 +103,7 @@ TEST(manifest, createFromFile) { } TEST(manifest, createFromFileWithSections) { - char *manifestFile = "../../celix/framework/private/resources-test/manifest_sections.txt"; + char manifestFile[] = "../../celix/framework/private/resources-test/manifest_sections.txt"; manifest_pt manifest = NULL; // properties_pt properties = properties_create(); properties_pt properties = (properties_pt) 0x40; Modified: incubator/celix/trunk/framework/private/test/requirement_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/requirement_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/requirement_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/requirement_test.cpp Tue Jan 14 09:21:53 2014 @@ -35,6 +35,9 @@ extern "C" { #include "requirement_private.h" #include "attribute.h" #include "version_range.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -47,6 +50,9 @@ TEST_GROUP(requirement) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { Modified: incubator/celix/trunk/framework/private/test/service_reference_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/service_reference_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/service_reference_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/service_reference_test.cpp Tue Jan 14 09:21:53 2014 @@ -33,6 +33,9 @@ extern "C" { #include "service_reference_private.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -45,6 +48,9 @@ TEST_GROUP(service_reference) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { Modified: incubator/celix/trunk/framework/private/test/service_registration_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/service_registration_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/service_registration_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/service_registration_test.cpp Tue Jan 14 09:21:53 2014 @@ -33,6 +33,9 @@ extern "C" { #include "service_registration_private.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -45,6 +48,9 @@ TEST_GROUP(service_registration) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { Modified: incubator/celix/trunk/framework/private/test/service_registry_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/service_registry_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/service_registry_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/service_registry_test.cpp Tue Jan 14 09:21:53 2014 @@ -33,6 +33,9 @@ extern "C" { #include "service_registry_private.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -45,6 +48,9 @@ TEST_GROUP(service_registry) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { Modified: incubator/celix/trunk/framework/private/test/service_tracker_customizer_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/service_tracker_customizer_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/service_tracker_customizer_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/service_tracker_customizer_test.cpp Tue Jan 14 09:21:53 2014 @@ -36,6 +36,9 @@ extern "C" { #include "service_tracker_customizer_private.h" #include "service_reference.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -48,6 +51,9 @@ TEST_GROUP(service_tracker_customizer) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { Modified: incubator/celix/trunk/framework/private/test/service_tracker_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/service_tracker_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/service_tracker_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/service_tracker_test.cpp Tue Jan 14 09:21:53 2014 @@ -35,6 +35,9 @@ extern "C" { #include "service_tracker_private.h" #include "service_reference_private.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -47,6 +50,9 @@ TEST_GROUP(service_tracker) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { Modified: incubator/celix/trunk/framework/private/test/version_range_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/version_range_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/version_range_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/version_range_test.cpp Tue Jan 14 09:21:53 2014 @@ -38,6 +38,10 @@ extern "C" #include "version_range_private.h" #include "version_private.h" + #include "celix_log.h" + + framework_logger_pt logger; + celix_status_t version_createEmptyVersion(apr_pool_t *pool, version_pt *version) { mock_c()->actualCall("version_createEmptyVersion") ->withPointerParameters("pool", pool) @@ -74,6 +78,9 @@ TEST_GROUP(version_range) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { Modified: incubator/celix/trunk/framework/private/test/version_test.cpp URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/test/version_test.cpp?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/test/version_test.cpp (original) +++ incubator/celix/trunk/framework/private/test/version_test.cpp Tue Jan 14 09:21:53 2014 @@ -32,6 +32,9 @@ extern "C" { #include "version_private.h" +#include "celix_log.h" + +framework_logger_pt logger; } int main(int argc, char** argv) { @@ -44,6 +47,9 @@ TEST_GROUP(version) { void setup(void) { apr_initialize(); apr_pool_create(&pool, NULL); + + logger = (framework_logger_pt) apr_palloc(pool, sizeof(*logger)); + logger->logFunction = frameworkLogger_log; } void teardown() { Modified: incubator/celix/trunk/framework/public/include/bundle.h URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/bundle.h?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/public/include/bundle.h (original) +++ incubator/celix/trunk/framework/public/include/bundle.h Tue Jan 14 09:21:53 2014 @@ -40,8 +40,9 @@ typedef struct bundle * bundle_pt; #include "module.h" #include "service_reference.h" #include "bundle_context.h" +#include "celix_log.h" -FRAMEWORK_EXPORT celix_status_t bundle_create(bundle_pt * bundle, apr_pool_t *mp); +FRAMEWORK_EXPORT celix_status_t bundle_create(bundle_pt * bundle, framework_logger_pt logger, apr_pool_t *mp); FRAMEWORK_EXPORT celix_status_t bundle_createFromArchive(bundle_pt * bundle, framework_pt framework, bundle_archive_pt archive, apr_pool_t *bundlePool); FRAMEWORK_EXPORT celix_status_t bundle_destroy(bundle_pt bundle); Modified: incubator/celix/trunk/framework/public/include/bundle_archive.h URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/bundle_archive.h?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/public/include/bundle_archive.h (original) +++ incubator/celix/trunk/framework/public/include/bundle_archive.h Tue Jan 14 09:21:53 2014 @@ -34,11 +34,12 @@ #include "celix_errno.h" #include "celixbool.h" #include "framework_exports.h" +#include "celix_log.h" typedef struct bundleArchive * bundle_archive_pt; -celix_status_t bundleArchive_create(char * archiveRoot, long id, char * location, char *inputFile, apr_pool_t *mp, bundle_archive_pt *bundle_archive); -celix_status_t bundleArchive_createSystemBundleArchive(apr_pool_t *mp, bundle_archive_pt *bundle_archive); +celix_status_t bundleArchive_create(framework_logger_pt logger, char * archiveRoot, long id, char * location, char *inputFile, apr_pool_t *mp, bundle_archive_pt *bundle_archive); +celix_status_t bundleArchive_createSystemBundleArchive(apr_pool_t *mp, framework_logger_pt logger, bundle_archive_pt *bundle_archive); celix_status_t bundleArchive_recreate(char * archiveRoot, apr_pool_t *mp, bundle_archive_pt *bundle_archive); FRAMEWORK_EXPORT celix_status_t bundleArchive_getId(bundle_archive_pt archive, long *id); Modified: incubator/celix/trunk/framework/public/include/bundle_context.h URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/bundle_context.h?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/public/include/bundle_context.h (original) +++ incubator/celix/trunk/framework/public/include/bundle_context.h Tue Jan 14 09:21:53 2014 @@ -41,7 +41,7 @@ typedef struct bundleContext *bundle_con #include "properties.h" #include "array_list.h" -celix_status_t bundleContext_create(framework_pt framework, bundle_pt bundle, bundle_context_pt *bundle_context); +celix_status_t bundleContext_create(framework_pt framework, framework_logger_pt, bundle_pt bundle, bundle_context_pt *bundle_context); celix_status_t bundleContext_destroy(bundle_context_pt context); FRAMEWORK_EXPORT celix_status_t bundleContext_getBundle(bundle_context_pt context, bundle_pt *bundle); Modified: incubator/celix/trunk/framework/public/include/bundle_revision.h URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/bundle_revision.h?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/public/include/bundle_revision.h (original) +++ incubator/celix/trunk/framework/public/include/bundle_revision.h Tue Jan 14 09:21:53 2014 @@ -34,6 +34,7 @@ #include "celix_errno.h" #include "manifest.h" +#include "celix_log.h" /** * Typedef for bundle_revision_pt. @@ -61,7 +62,7 @@ typedef struct bundleRevision * bundle_r * - CELIX_SUCCESS when no errors are encountered. * - CELIX_ENOMEM If allocating memory for <code>bundle_revision</code> failed. */ -celix_status_t bundleRevision_create(apr_pool_t *pool, char *root, char *location, long revisionNr, char *inputFile, bundle_revision_pt *bundle_revision); +celix_status_t bundleRevision_create(apr_pool_t *pool, framework_logger_pt logger, char *root, char *location, long revisionNr, char *inputFile, bundle_revision_pt *bundle_revision); /** * Retrieves the revision number of the given revision. Modified: incubator/celix/trunk/framework/public/include/celix_log.h URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/celix_log.h?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/framework/public/include/celix_log.h (original) +++ incubator/celix/trunk/framework/public/include/celix_log.h Tue Jan 14 09:21:53 2014 @@ -31,17 +31,6 @@ #include "framework_exports.h" -#define fw_log(level, fmsg, args...) framework_log(level, __func__, __FILE__, __LINE__, fmsg, ## args) -#define fw_logCode(level, code, fmsg, args...) framework_logCode(level, __func__, __FILE__, __LINE__, code, fmsg, ## args) -#define framework_logIfError(status, error, fmsg, args...) \ - if (status != CELIX_SUCCESS) { \ - if (error != NULL) { \ - fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, #fmsg"; cause: "#error, ## args); \ - } else { \ - fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, #fmsg, ## args); \ - } \ - } - enum framework_log_level { OSGI_FRAMEWORK_LOG_ERROR = 0x00000001, @@ -52,7 +41,29 @@ enum framework_log_level typedef enum framework_log_level framework_log_level_t; -FRAMEWORK_EXPORT void framework_log(framework_log_level_t level, const char *func, const char *file, int line, char *fmsg, ...); -FRAMEWORK_EXPORT void framework_logCode(framework_log_level_t level, const char *func, const char *file, int line, celix_status_t code, char *fmsg, ...); +typedef struct framework_logger *framework_logger_pt; + +extern framework_logger_pt logger; + +typedef celix_status_t (*framework_log_function_pt)(framework_log_level_t level, const char *func, const char *file, int line, char *msg); + +struct framework_logger { + framework_log_function_pt logFunction; +}; + +#define fw_log(logger, level, fmsg, args...) framework_log(logger, level, __func__, __FILE__, __LINE__, fmsg, ## args) +#define fw_logCode(logger, level, code, fmsg, args...) framework_logCode(logger, level, __func__, __FILE__, __LINE__, code, fmsg, ## args) +#define framework_logIfError(logger, status, error, fmsg, args...) \ + if (status != CELIX_SUCCESS) { \ + if (error != NULL) { \ + fw_logCode(logger, OSGI_FRAMEWORK_LOG_ERROR, status, #fmsg"; cause: "#error, ## args); \ + } else { \ + fw_logCode(logger, OSGI_FRAMEWORK_LOG_ERROR, status, #fmsg, ## args); \ + } \ + } + +FRAMEWORK_EXPORT celix_status_t frameworkLogger_log(framework_log_level_t level, const char *func, const char *file, int line, char *fmsg); +FRAMEWORK_EXPORT void framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, char *fmsg, ...); +FRAMEWORK_EXPORT void framework_logCode(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, celix_status_t code, char *fmsg, ...); #endif /* CELIX_LOG_H_ */ Modified: incubator/celix/trunk/launcher/private/src/launcher.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/launcher/private/src/launcher.c?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/launcher/private/src/launcher.c (original) +++ incubator/celix/trunk/launcher/private/src/launcher.c Tue Jan 14 09:21:53 2014 @@ -107,7 +107,7 @@ int main(void) { // Only add bundle if it is installed correctly arrayList_add(installed, current); } else { - fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, CELIX_BUNDLE_EXCEPTION, "Could not install bundle from %s", location); + printf("Could not install bundle from %s\n", location); } linkedListIterator_remove(iter); } @@ -129,13 +129,13 @@ int main(void) { } if (status != CELIX_SUCCESS) { - fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Problem creating framework"); + printf("Problem creating framework\n"); } apr_pool_destroy(memoryPool); apr_terminate(); - fw_log(OSGI_FRAMEWORK_LOG_INFO, "Launcher: Exit"); + printf("Launcher: Exit\n"); return 0; } Modified: incubator/celix/trunk/remote_services/remote_service_admin_http/private/src/export_registration_impl.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/remote_service_admin_http/private/src/export_registration_impl.c?rev=1557991&r1=1557990&r2=1557991&view=diff ============================================================================== --- incubator/celix/trunk/remote_services/remote_service_admin_http/private/src/export_registration_impl.c (original) +++ incubator/celix/trunk/remote_services/remote_service_admin_http/private/src/export_registration_impl.c Tue Jan 14 09:21:53 2014 @@ -87,13 +87,13 @@ celix_status_t exportRegistration_stopTr if (registration->endpointTracker != NULL) { status = serviceTracker_close(registration->endpointTracker); if (status != CELIX_SUCCESS) { - fw_log(OSGI_FRAMEWORK_LOG_ERROR, "EXPORT_REGISTRATION: Could not close endpoint tracker"); + fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "EXPORT_REGISTRATION: Could not close endpoint tracker"); } } if (registration->tracker != NULL) { status = serviceTracker_close(registration->tracker); if (status != CELIX_SUCCESS) { - fw_log(OSGI_FRAMEWORK_LOG_ERROR, "EXPORT_REGISTRATION: Could not close service tracker"); + fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "EXPORT_REGISTRATION: Could not close service tracker"); } }
