Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 06-14-2023, 05:59 AM   #1
otakutyrant
Member
otakutyrant began at the beginning.
 
Posts: 13
Karma: 10
Join Date: May 2023
Device: Kindle
My logging does not output filename and funcName

I use this code in my __init__.py of New Words Loss:https://github.com/otakutyrant/New-Words-Loss

FORMAT = "[%(filename)s->%(funcName)s():]%(levelname)s: %(message)s"
logging.basicConfig(format=FORMAT, level=logging.INFO)

But strangely, when I run the plugin: `calibre-debug -s; calibre-customize -b .; calibre`, all logging.info only prints levelname and message but filename and funcName, like this: INFO:root:Infering New Words Loss in 1 books.
otakutyrant is offline   Reply With Quote
Old 06-14-2023, 06:49 AM   #2
otakutyrant
Member
otakutyrant began at the beginning.
 
Posts: 13
Karma: 10
Join Date: May 2023
Device: Kindle
It seems that this logging.basicConfig does not work well. So I use logger instead in my new logging.py;

import logging

logger = logging.getLogger("New Words Loss")
handler = logging.StreamHandler()
formatter = logging.Formatter(
"[%(filename)s->%(funcName)s():]\n%(levelname)8s: %(message)s"
)
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.setLevel(logging.INFO)

And it solved!
otakutyrant is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
recipe output is MOBI even if AZW3 is set as prefered output format. unkn0wn Recipes 1 06-29-2022 02:27 AM
Output Filename gamefreak_693 Conversion 6 08-04-2021 03:08 PM
[Conversion Output] Markdown Output. Test and seek for help. The_book Development 10 04-18-2020 09:23 AM
catalogue builder output columns are not in the same order in the output KWhytte Library Management 5 12-04-2012 02:03 AM
output filename format jdh Calibre 6 08-12-2009 09:35 PM


All times are GMT -4. The time now is 08:02 AM.


MobileRead.com is a privately owned, operated and funded community.