Logging formatting information, function name and corresponding line number cannot be located

25 views
Skip to first unread message

Derrick Rose

unread,
Nov 18, 2024, 6:31:37 AM11/18/24
to cython-users
For plaintext Python files, the logging library can effectively retrieve function names and locate line numbers during log printing by formatting the log settings. However, compiling it into pyd renders these functions ineffective. I need some suggestions. Thank you for your feedback!

logging.basicConfig(level=logging.DEBUG,
filename='app.log', 
filemode='a',
format="%(asctime)s %(levelname)s [%(module)s:%(lineno)d] [func:%(funcName)s] %(message)s")

da-woods

unread,
Nov 18, 2024, 1:33:35 PM11/18/24
to cython...@googlegroups.com
I don't know if there's a good option here. "logging" inspects the stack for the stack frame of the calling function which I think is what it uses for module, lineno, and funcName. Cython doesn't create stack frames so the information doesn't really exist unfortunately.
--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/cython-users/9648ec70-1d87-48ef-9ee2-eaa601c9b897n%40googlegroups.com.


Reply all
Reply to author
Forward
0 new messages