是否有一些相对简单的方法以编程方式将源代码行包含到python logger报告中.例如...
import logging
def main():
something_is_not_right = True
logging.basicConfig(level=logging.DEBUG,
format=('%(filename)s: '
'%(levelname)s: '
'%(funcName)s(): '
'%(lineno)d:\t'
'%(message)s')
)
if something_is_not_right == True:
logging.debug('some way to get previous line of source code here?')
Run Code Online (Sandbox Code Playgroud)
所以输出看起来像这样.
example.py: DEBUG: main(): 14: if something_is_not_right == True:
Run Code Online (Sandbox Code Playgroud) 有可能让Emacs显示不同字体的文件的不同部分吗?作为一个特定的问题,我希望能够以正常方式呈现以下小型XML文件,但是"示例"元素中的"文本"部分具有不同的字体和字体大小.
<?xml version="1.0"?>
<root>
<example>text</example>
</root>
Run Code Online (Sandbox Code Playgroud)
如果它有任何区别我有GNU Emacs 23.1.1的GTK +版本2.22.0.