logc: change naming convention for log macros
This is a pretty huge and incompatible change. The decision to do this was hard but we have to do it now as later it would be even harder to change it. The incentive behind this is to have same naming convention across the whole LogC headers. Until now there were two files using one convention and two other files using a different one.
The old convention was that lover case functions expect log
specification and upper case use DEFLOG
.
This was incompatible with assert replacement and thus different
convention was chosen there. The log accepting functions were prefixed
with log_
and by losing that prefix DEFLOG
is used.
The second calling convention turns out to be kind of better as it
allows higher freedom with macro naming and thus with the implementation
of alternatives for existing tools. It also reduces collisions with
existing headers such as error.h
if the user chooses to use both.
The migration of existing code using LogC can be done using the following command but always check that result is what you expect. find -type f -name '*.[ch]' | xargs sed -Ei 's#\b(critical|error|warning|notice|info|debug|trace|not_implemented|std_ignore|std_fatal)(#log_\1(#g;s#\b(CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG|TRACE|STD_IGNORE|STD_FATAL)(#\L&(#g;s#\b(NOT_IMPLEMENTED);#\L&#g'
The primary incompatibility here is that new name for macro using
DEFLOG
is the same as the original name for macro expecting log as
first argument.