Category: Programming

Documenting my family-history

Having been digging around my family history, I really need to get it documented…
I have been keeping notes in an LibreOffice document, and pondering how to link the tree into, my notes and various media…
and am looking at Gramps 4.1.0 (running on Ubuntu Linux) – as this looks like a possible solution

to build all that into into a web/html solution that I can then stick on a CD for the family (in a portable XAMPP solution)…

Advertisements

Python logging & custom message levels…

Having played with this for a little too long…  I found a simple fix…

My problem was when defining a new custom logging level –

    logger = logging.getLogger(myProj)
    logging.addLevelName(alertNo,"ALERT")
    logger.setLevel(logging.INFO)   # default

and then checking that user edited config options are valid, with –

            x = (sys.argv[1]).upper()
            n = getattr(logging,x,None)
            if not isinstance(n, int):
                logger.error('Invalid log level argument: %s'%x)
            else:
                dbugLvl = x
                logger.info("Logging level : %s"%dbugLvl)
                logger.setLevel(dbugLvl)

This did not recognise my new “ALERT” level.

The simple fix is to add to the initial code –

    logging.ALERT=alertNo

I hope this helps someone else avoid hours of fun…