[liblouis-liblouisxml] Unsure how to do a change to logging

  • From: "Michael Whapples" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "mwhapples@xxxxxxx" for DMARC)
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Wed, 21 May 2014 18:15:08 +0100

Hello,
In changing the logging so that lou_log and lou_logPrint are not public, I have hit a difficulty.

The problem is that in liblouisutdml, how I set a default log handler? This might seem initially simple, just do it in the same way as in liblouis. This however is not enough, it sets a default handler in liblouisutdml but not in liblouis.

You may ask so what is the problem with that? It means that should someone set a file name for the default log handler (eg. lbu_logFilename), this gets set on liblouisutdml but ont on liblouis. Having two handlers accessing one file (one handler in liblouis and one in liblouisutdml) might cause file access problems.

What I need is a C version of a static initialiser (think of static initialisers in Java) where I could call lou_registerLogCallback(NULL) from liblouisutdml.

Failing that, I can only see two possible options:
1. Find every public function call in liblouisutdml and do a check/register there. Risk being one will get missed and may become a maintanence issue for the longer term. 2. The shared library option I suggested for logging code, then there is only a single storing of the registered callback.

Michael Whapples
For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts: