celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bjoern Petri <bjoern.pe...@sundevil.de>
Subject Re: svn commit: r1627453 - /celix/trunk/remote_services/topology_manager/private/src/activator.c
Date Thu, 25 Sep 2014 08:43:30 GMT
On 2014-09-25 08:52, Alexander Broekhuis wrote:
> 2014-09-25 8:30 GMT+02:00 Björn Petri <bjoern.petri@sundevil.de>:
> [...]
> I guess you mean tracking the log_service and not register/unregister,
> since that is part of the log_service's implementation itself.
> I am not so sure. The boilerplate code for getting the log_service 
> should
> be minimized using a dependency manager or something. But since we 
> don't
> have that one yet, we could add a piece of public code to the 
> log_service
> containing a pre-setup tracker for the log_service.
> But then it is still needed to check if the log_service is available 
> before
> logging. This could simply be put in a method inside your own 
> component,
> only about 5 lines or something.. If a printf fallback is needed, it 
> could
> be placed in that code as well.
> static myComponent_log(my_component_pt cmp, log_level_t level, char 
> *log) {
>   if (cmp->logService) {
>     cmp->logService->log(cmp->logService->logger, level, log);
>   } else {
>     printf("STDOUT Log: %s", log);
>   }
> }

For one of our projects (MachineServices) we've a common code part, 
containing functionality which are implemented by several bundles. Among 
other things we also have ms_log which takes care of setting up a 
tracker for the log_service as well as a log function like the one you 
mentioned. What do you think about adding something similar to utils?

View raw message