This new module doesn't break old code, it doesn't delete eina_error.
Also, changing everything is not so easy, as lots of people use EINA_ERROR
macros without calling eina_error_init() (that is, we can't just sed the
macros as eina_log won't be init'd and it will break everything).

As the patch doesn't break but deprecate eina_error, my "lazy" suggestion is
to let people change to the new API. It's actually a lot of code that would
need to be changed.

On Tue, Aug 18, 2009 at 11:21 AM, Gustavo Sverzut Barbieri
<barbi...@profusion.mobi> wrote:

> This feels all right, prepare a commit changing other SVN stuff to
> this new system and mail me so I don't leave svn broken for too long.
>
> Ready to commit as soon as you send the patch converting other stuff.
>
> Regards,
>
> On Sun, Aug 16, 2009 at 9:32 PM, Andre Dieb<andre.mart...@ee.ufcg.edu.br>
> wrote:
> > - Added eina_log to Eina.h
> > - Removed debug fprintf, do not use eina_safety for (level > d->level)
> > check, it floods the screen
> >
> > On Sun, Aug 16, 2009 at 8:54 PM, Andre Dieb <
> andre.mart...@ee.ufcg.edu.br>
> > wrote:
> >>
> >> Another attempt attached, see modifications list and inline comments
> >> below.
> >>
> >> - DOM is now a prefix: EINA_LOG_DOM_(level)
> >> - renamed EINA_COLOR_NOTHING to EINA_COLOR_RESET
> >> - fixed loop problem at pending domains parse
> >> - removed eina_log_msg_* funcs, they're kept on eina_error
> >> - removed trailing whitespaces
> >> - changed colors
> >> - domain free happens now on unregister()
> >> - shutdown ignores deleted entries
> >> - added a test case for level color normalization (if negative, show it
> >> with the lowest color possible - crit. If higher than debug, show it
> with
> >> light blue)
> >>
> >> I couldn't avoid ##__VA_ARGS__ on macros, help would be good.
> >>
> >> On Sun, Aug 16, 2009 at 11:50 AM, Gustavo Sverzut Barbieri
> >> <barbi...@profusion.mobi> wrote:
> >>>
> >>> On Sun, Aug 16, 2009 at 5:45 AM, Andre Dieb<
> andre.mart...@ee.ufcg.edu.br>
> >>> wrote:
> >>> > One more thing,
> >>> >
> >>> > On Sun, Aug 16, 2009 at 5:26 AM, Andre Dieb
> >>> > <andre.mart...@ee.ufcg.edu.br>
> >>> > wrote:
> >>> >>
> >>> >> Sorry for the HTML! :)
> >>> >>
> >>> >> On Sat, Aug 15, 2009 at 10:39 PM, Gustavo Sverzut Barbieri
> >>> >> <barbi...@profusion.mobi> wrote:
> >>> >>>
> >>> >>> On Sat, Aug 15, 2009 at 5:55 PM, Andre
> >>> >>> Dieb<andre.mart...@ee.ufcg.edu.br>
> >>> >>> wrote:
> >>> >>> > Changes:
> >>> >>> >
> >>> >>> > Module name is now eina_log (but I didn't delete eina_error yet,
> as
> >>> >>> > we
> >>> >>> > should delete it only when the transition is completed)
> >>> >>> > Docs on header and basic doc on .c file, but there's a lot of
> room
> >>> >>> > for
> >>> >>> > doc
> >>> >>> > improvement
> >>> >>> > Save name on domains
> >>> >>> > Clean realloc code
> >>> >>> > Keep parsing EINA_LOG_LEVELS even when user types wrong (e.g.
> >>> >>> > domain1:level1,domain2:,domain3,domain:5)
> >>> >>> > Migrate old global logger code to global logger (i.e. remove old
> >>> >>> > deprecated
> >>> >>> > functions)
> >>> >>>
> >>> >>> arghhhhhh... HTML MAIL!
> >>> >>>
> >>> >>> now to the points
> >>> >>>  - _DOM is not a suffix, rather a prefix namespace... like
> >>> >>> EINA_LOG_ERR and EINA_LOG_DOM_ERR...
> >>> >>>  - I remember Sun compiler barfing at ##__VA_ARGS__, maybe we need
> to
> >>> >>> avoid that? Vincent?? (avoid that is define just as (...) and user
> is
> >>> >>> obligated to give at least one parameter, fmt. That makes things
> >>> >>> uglier IMHO)
> >>> >>
> >>> >> That == define as "..." ? Should it be done with ... ?
> >>> >> I'm sorry, I didn't follow.
> >>>
> >>> ## is a "hack" to remove the last "," if no arguments are provided.
> >>> So these would work similarly
> >>>
> >>>   X(a, ...)  bla(a, ##__VA_ARGS__)
> >>>   X(...) bla(__VA_ARGS__)
> >>>
> >>> tests
> >>>
> >>>   X(1, 2, 4)  bla(1, 2, 4)
> >>>   X(1) bla(1)
> >>
> >> Here's how it is now. Could you please point how to avoid ## ?
> >>
> >> #define EINA_LOG(DOM, LEVEL, fmt, ...) \
> >>     eina_log_print(DOM, LEVEL, __FILE__, __FUNCTION__, __LINE__, fmt,
> >> ##__VA_ARGS__)
> >>
> >> #define EINA_LOG_DOM_CRIT(DOM, fmt, ...) \
> >>     EINA_LOG(DOM, EINA_LOG_LEVEL_CRITICAL, fmt, ##__VA_ARGS__)
> >>
> >>
> >>>
> >>> >>>
> >>> >>>  - _Eina_Log_Level define a value < 0 (EINA_LOG_LEVEL_MIN =
> >>> >>> INT32_MIN) so compilers don't optimize that enum as an unsigned
> >>> >>> integer, causing problems for users trying to specify something
> like
> >>> >>> -1 for "more critical"
> >>> >>>
> >>> >>>  - +typedef int Eina_Log; "too much", I'd use it as integer, no
> need
> >>> >>> to typedef.
> >>> >>
> >>> >> This typedef was already on the code, it was for Eina_Error (a
> handle
> >>> >> for
> >>> >> registered errors). Just remove it ?
> >>>
> >>> argh... if it was there, keep it.
> >>>
> >>>
> >>> >>>  - keep these as "eina_error", you're fixing error->log, but having
> >>> >>> error codes as log codes is too much, like broking and not fixing
> =)
> >>> >>> This holds true for eina_log_msg_register and friends...
> >>> >
> >>> > Put these eina_error_msg_* functions into eina_log or keep eina_error
> >>> > only
> >>> > for that?
> >>>
> >>> keep it for these things
> >>>
> >>>
> >>> >>> +/**
> >>> >>> + * @var EINA_LOG_OUT_OF_MEMORY
> >>> >>> + * Log identifier corresponding to a lack of memory.
> >>> >>> + */
> >>> >>> +EAPI extern Eina_Log EINA_LOG_MSG_OUT_OF_MEMORY;
> >>> >>>  - colors should be improved, for example (even the old code is not
> >>> >>> good)
> >>> >>> +static const char *_colors[EINA_LOG_LEVELS] = {
> >>> >>> +  EINA_COLOR_YELLOW, // EINA_LOG_LEVEL_CRITICAL
> >>> >>> +  EINA_COLOR_RED, // EINA_LOG_LEVEL_ERR
> >>> >>> +  EINA_COLOR_YELLOW, // EINA_LOG_LEVEL_WARN
> >>> >>> +  EINA_COLOR_NOTHING, // EINA_LOG_LEVEL_INFO
> >>> >>> +  EINA_COLOR_GREEN, // EINA_LOG_LEVEL_DBG
> >>> >>> +};
> >>> >>> for me, the more "red", more dangerous... more "green" better... So
> I
> >>> >>> usually use as rule in my debugs:
> >>> >>>   - light (\033[1m) red = critical
> >>> >>>   - regular (dark) red = error
> >>> >>>   - yellow = warning
> >>> >>>   - green = info
> >>> >>>   - light blue = debug
> >>> >>>   - regular blue = more than debug
> >>> >>>
> >>> >>> things I told you in previous mails:
> >>> >>>
> >>> >>>  - trailing whitespaces!!!
> >>> >>
> >>> >> I couldn't find any trailing whitespaces, could you please point
> them?
> >>>
> >>> grep -n '[ ]\+$' eina_logging_domains5.diff  | cut -d: -f1 | tr '\n'
> ','
> >>>
> >>> 10,26,450,1314
> >>
> >> neat!
> >>
> >>>
> >>>
> >>>
> >>> >>>  - have you tested the parse of broken EINA_LOG_LEVELS? Note this
> >>> >>> +       level = strtol((char *)(end + 1), &tmp, 10);
> >>> >>> +       if (tmp == (end + 1)) continue;
> >>> >>> you do not change start, what happens? infinite loops... you need
> to
> >>> >>> have start = next pair, so need to search for "," and update start
> to
> >>> >>> that.... or add an "end" label right after appending to pending
> list
> >>> >>> and "goto end" instead of continue.
> >>> >>>  - eina_log_shutdown() should ignore already deleted entries.
> >>> >>>  - eina_log_domain_register() should not free domains, they should
> be
> >>> >>> freed in eina_log_domain_unregister()
> >>> >>>
> >>> >>>
> >>> >>> --
> >>> >>> Gustavo Sverzut Barbieri
> >>> >>> http://profusion.mobi embedded systems
> >>> >>> --------------------------------------
> >>> >>> MSN: barbi...@gmail.com
> >>> >>> Skype: gsbarbieri
> >>> >>> Mobile: +55 (19) 9225-2202
> >>> >>
> >>> >> Thanks a lot for the patience, I hope I can learn with these
> mistakes
> >>> >> :-).
> >>>
> >>> =)
> >>>
> >>> --
> >>> Gustavo Sverzut Barbieri
> >>> http://profusion.mobi embedded systems
> >>> --------------------------------------
> >>> MSN: barbi...@gmail.com
> >>> Skype: gsbarbieri
> >>> Mobile: +55 (19) 9225-2202
> >>
> >>
> >>
> >> --
> >> 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/
> >
> >
> >
> > --
> > 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/
> >
>
>
>
> --
> Gustavo Sverzut Barbieri
> http://profusion.mobi embedded systems
> --------------------------------------
> MSN: barbi...@gmail.com
> Skype: gsbarbieri
> Mobile: +55 (19) 9225-2202
>



-- 
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

Reply via email to