[OPEN-ILS-DEV] PATCH: log.[ch] (localizing various things)

Mike Rylander mrylander at gmail.com
Mon Jun 18 13:59:47 EDT 2007


I've attached a slight reworking of your patch for general
consumption.  Comments below.

Thanks, Scott

--miker

On 6/17/07, Scott McKellar <mck9 at swbell.net> wrote:
> This patch tidies up log.h and log.c a bit, mostly by moving various
> things from the former to the latter.  In all cases I verified that
> no other source code referenced the things changed, apart from a
> few spurious matches in some python modules.
>
> 1. Whenever a declared identifier had two leading underscores, I
> removed the first one, except for a few cases where I removed the
> second one and kept the first one.
>
> 2. I moved the following macros to log.c:
>
>  OSRF_LOG_ERROR
>  OSRF_LOG_WARNING
>  OSRF_LOG_INFO
>  OSRF_LOG_DEBUG
>  OSRF_LOG_INTERNAL
>  OSRF_LOG_ACTIVITY
>  OSRF_LOG_GO

For the time being I'm going to leave these defined in the header,
along with the osrfLogSetLevel() function, as I can certainly see the
need, during development of an application, to change the logging
level for a short section of code.  To support that, I'm going to add
a osrfLogGetLevel() function to retrieve the current level for later
resetting.

>
> 3. I moved the prototypes for the following functions to log.c, and
> declared them static:
>
>  osrfLogSetType
>  osrfLogSetLevel
>  _osrfLogDetail
>  _osrfLogToFile
>  _osrfLogSetXid
>

As mentioned, osrfLogSetLevel is now excluded from that list.

> 4. I almost moved the prototype for osrfLogSetActivityEnabled(), but
> then I noticed that nothing called it even in log.c.  So I left it
> where it was, on the theory that it was intended for external
> linkage even if nobody was using it yet.
>

Yes, it's meant to be called from outside log.c.

> 5. I declared the following variables static:
>
>  _osrfLogType
>  _osrfLogFacility
>  _osrfLogActFacility
>  _osrfLogFile
>  _osrfLogAppname
>  _osrfLogLevel
>  _osrfLogActivityEnabled
>  _osrfLogIsClient
>  _osrfLogXid
>  _osrfLogXidPfx
>
> 6. I declared _osrfLogXidInc static, and also moved it into the
> osrfLogMkXid function, which is the only function that uses it.
>
> Scott McKellar
> http://home.swbell.net/mck9/aargh/
>
> Developer's Certificate of Origin 1.1 By making a contribution to
> this project, I certify that:
>
> (a) The contribution was created in whole or in part by me and I
> have the right to submit it under the open source license indicated
> in the file; or
>
> (b) The contribution is based upon previous work that, to the best
> of my knowledge, is covered under an appropriate open source license
> and I have the right under that license to submit that work with
> modifications, whether created in whole or in part by me, under the
> same open source license (unless I am permitted to submit under a
> different license), as indicated in the file; or
>
> (c) The contribution was provided directly to me by some other person
> who certified (a), (b) or (c) and I have not modified it; and
>
> (d) In the case of each of (a), (b), or (c), I understand and agree
> that this project and the contribution are public and that a record
> of the contribution (including all personal information I submit
> with it, including my sign-off) is maintained indefinitely and may
> be redistributed consistent with this project or the open source
> license indicated in the file.
>


-- 
Mike Rylander
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reworked-logging.patch
Type: text/x-patch
Size: 10270 bytes
Desc: not available
Url : http://list.georgialibraries.org/pipermail/open-ils-dev/attachments/20070618/7e97c640/reworked-logging.bin


More information about the Open-ils-dev mailing list