Hello, On the beginning of a module, program or library, you must call eina_log_init() for initializing the library. After that, you should call eina_log_domain_register(domain_name, color) for registering a new domain, note that this call returns an index associated with the created domain. When your program is shutting down, it must unregister registered domains and call eina_log_shutdown().
Almost all files under http://trac.enlightenment.org/e/browser/trunk/PROTO/eupnp/src/lib have this pattern (init, register/save, shutdown). Also, note on eupnp_log.c that I defined a global logging domain for the project. There's a native global domain to which macros without DOM apply, but if you want things customized like I do, you should do that way. We also recommend to define your own macros, do not use EINA_LOG_DOM_* or EINA_LOG_* directly, for example (from eupnp_log.h): // Here we declare a variable to save the global logging domain EAPI extern int EUPNP_LOGGING_DOM_GLOBAL; // Define your own macros based on EINA_LOG_DOM_* #define WARN(...) EINA_LOG_DOM_WARN(EUPNP_LOGGING_DOM_GLOBAL, __VA_ARGS__) #define DEBUG(...) EINA_LOG_DOM_DBG(EUPNP_LOGGING_DOM_GLOBAL, __VA_ARGS__) #define INFO(...) EINA_LOG_DOM_INFO(EUPNP_LOGGING_DOM_GLOBAL, __VA_ARGS__) #define ERROR(...) EINA_LOG_DOM_ERR(EUPNP_LOGGING_DOM_GLOBAL, __VA_ARGS__) #define CRIT(...) EINA_LOG_DOM_CRIT(EUPNP_LOGGING_DOM_GLOBAL, __VA_ARGS__) #define WARN_D(DOM, ...) EINA_LOG_DOM_WARN(DOM, __VA_ARGS__) #define DEBUG_D(DOM, ...) EINA_LOG_DOM_DBG(DOM, __VA_ARGS__) #define INFO_D(DOM, ...) EINA_LOG_DOM_INFO(DOM, __VA_ARGS__) #define ERROR_D(DOM, ...) EINA_LOG_DOM_ERR(DOM, __VA_ARGS__) #define CRIT_D(DOM, ...) EINA_LOG_DOM_CRIT(DOM, __VA_ARGS__) And on eupnp_log.c, we initialize and save the domain index: if (!eina_log_init()) { fprintf(stderr, "Failed to initialize eina error module.\n"); return 0; } EUPNP_LOGGING_DOM_GLOBAL = eina_log_domain_register("Eupnp", EINA_COLOR_RESET); if (EUPNP_LOGGING_DOM_GLOBAL < 0) { fprintf(stderr, "Failed to register global error domain.\n"); eina_log_shutdown(); return 0; } A basic migration approach follows: 1. Find EINA_ERROR_P* macros and change them to the new ones: EINA_LOG_DOM_* (grep :-)) 2. Check if eina_error_set(), eina_error_msg_register() are being used. If they aren't, you can remove eina_error_init() and eina_error_shutdown(). Note that I found some libs using EINA_ERROR_ macros and not calling eina_error_init(). Hope this and code examples are enough. Any doubts please post on the ML. Thanks, On Tue, Sep 1, 2009 at 12:26 PM, Mathieu Taillefumier < mathieu.taillefum...@free.fr> wrote: > Hi, > > I am willing to help if needed. It is a good way to enter into the details > of the library. So I think I need a very small example how it works and I > might be able to do these changes. > > best > > Mathieu > > > > On 09/01/2009 11:58 AM, Andre Dieb wrote: > >> I plan to change what I can, but I'll certainly need help. >> Basically we need to eina_log_init() and eina_log_shutdown() (some places >> are only using macros directly and not init'ing - won't work with new >> API). >> Also, you can't just replace eina_error_init() because these apps also use >> eina_error API for error messages and codes (that will be kept). >> >> On Tue, Sep 1, 2009 at 6:28 AM, Rocco Carbone<ro...@tecsiel.it> wrote: >> >> >> >>> On 1 September 11:15 2009 Cedric BAIL spoke: >>> | On Tue, Sep 1, 2009 at 12:22 AM, Gustavo Sverzut >>> | Barbieri<barbi...@profusion.mobi> wrote: >>> |>  - fixing bugs reported by Luis Felipe's LLVM/Clang: >>> |> http://local.profusion.mobi:8081/~lfelipe/output-efl/ >>> |>  - moving code from fprintf/printf to eina_log (prefer to do this >>> |> BEFORE this weekend!) >>> | >>> | eina_log should also be used more inside eina, I don't know if André >>> | Dieb plan to do it, but you can do a file by file hunt of eina_error >>> | and replace it with eina_log. Perhaps André you can do one small >>> | commit so others can understand what needs to be done. >>> | >>> |> Enlightenment DR17 is quite stable these days, the release items are >>> |> almost all done. Items under "Reorganize, Layout and Visual Changes" >>> |> are the biggest pending, but Raster already talked about postponing >>> |> those. But in turn, Edje received new Lua scripting support, that >>> |> really needs to be improved so Edje and thus E17 can be released. >>> | >>> | Well, Edje received a lot of internal improvement during the past >>> | week, not only lua, but the way all edje_recalc is done also. >>> | Apparently all breakage are fixed now, but if you see anything >>> | strange, don't hesitate to report. >>> | >>> |> Cedric wished to release Eina last time but we were missing >>> eina_log, >>> |> just introduced by André Dieb some weeks ago. Probably with some >>> love >>> |> we can make it 1.0 and be happy to release another important >>> building >>> |> block. >>> | >>> | Yep, just need a little bit of work around eina_log and we will be >>> | ready for a release of Eina. If people can take time for a last API >>> | review it would be nice. >>> | >>> | Have fun :-) >>> | -- >>> | Cedric BAIL >>> | >>> | >>> >>> ------------------------------------------------------------------------------ >>> | Let Crystal Reports handle the reporting - Free Crystal Reports 2008 >>> 30-Day >>> | trial. Simplify your report design, integration and deployment - and >>> focus on >>> | what you do best, core application coding. Discover what's new with >>> | Crystal Reports now. http://p.sf.net/sfu/bobj-july >>> | _______________________________________________ >>> | enlightenment-devel mailing list >>> | enlightenment-devel@lists.sourceforge.net >>> | https://lists.sourceforge.net/lists/listinfo/enlightenment-devel >>> >>> -- >>> Rocco Carbone mail-to:<rocco /at/ tecsiel /dot/ it> >>> Pisa Italy >>> >>> Life is in the details >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 >>> 30-Day >>> trial. Simplify your report design, integration and deployment - and >>> focus >>> on >>> what you do best, core application coding. Discover what's new with >>> Crystal Reports now. http://p.sf.net/sfu/bobj-july >>> _______________________________________________ >>> enlightenment-devel mailing list >>> enlightenment-devel@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel >>> >>> >>> >> >> >> >> > > -- André Dieb Martins Embedded Systems and Pervasive Computing Lab (Embedded) Electrical Engineering Department (DEE) Center of Electrical Engineering and Informatics (CEEI) Federal University of Campina Grande (UFCG) Blog: http://genuinepulse.blogspot.com/ ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel