You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by Bjoern Petri <bj...@sundevil.de> on 2014/11/12 22:47:54 UTC

common code for log_service tracking

Hi everyone,

It's been a while since we've discussed about the logging-mechanisms 
within celix. Instead of plain printfs, the preferable way should be to 
use a service tracker to pick up the logging service. In terms of code 
reuse, it definitely would make sense to have the code located at one 
location, which can be shared by several bundles.

My first idea to use celix_log.c/fw_log for that purpose does not seem 
to be possible due to locking issue. Hence, I just committed 
log_service/public/src/log_helper.c (and an according header file) 
offering loghelper_create, _start, _stop, _destroy and of course 
_log-functionality which implements a service tracker for the 
log_helper. As an example, I integrated this functionality into the 
remote_shell bundle. If everyone agrees with this approach, we could 
also re-use this in other bundles. What do you think?

Regards,
   Bjoern

Re: common code for log_service tracking

Posted by Alexander Broekhuis <a....@gmail.com>.
Hi,

I've looked at the code, and the only code remark I can make is a minor
one. In logHelper_log you do a check to see if there are any entries in the
list, but the for loop already takes care of it ;).
With regards to installation, the new files are not added yet. The
following update/replacement to the CMakeLists.txt is needed:

install_bundle(log_service
 HEADERS
       public/include/log_service.h public/include/log_helper.h
RESOURCES
       public/src/log_helper.c
)

This way, the log_helper.c will be installed in the
<prefix>/share/celix/... directory.

But I think this can be reused in other bundles. Thanks!

Op Wed Nov 12 2014 at 4:48:24 PM schreef Bjoern Petri <
bjoern.petri@sundevil.de>:


> Hi everyone,
>
> It's been a while since we've discussed about the logging-mechanisms
> within celix. Instead of plain printfs, the preferable way should be to
> use a service tracker to pick up the logging service. In terms of code
> reuse, it definitely would make sense to have the code located at one
> location, which can be shared by several bundles.
>
> My first idea to use celix_log.c/fw_log for that purpose does not seem
> to be possible due to locking issue. Hence, I just committed
> log_service/public/src/log_helper.c (and an according header file)
> offering loghelper_create, _start, _stop, _destroy and of course
> _log-functionality which implements a service tracker for the
> log_helper. As an example, I integrated this functionality into the
> remote_shell bundle. If everyone agrees with this approach, we could
> also re-use this in other bundles. What do you think?
>
> Regards,
>    Bjoern
>