有没有办法获取当前函数的函数名? [英] Is there a way to obtain the function name of current function?
本文介绍了有没有办法获取当前函数的函数名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前这样做:
code>(defun foo()
(send-to-debug-logError。Function terminated。'foo)))
硬编码功能名称似乎不是一个好习惯。
任何实现 get-current-function-name
或 get-function-name-call-me $的建议c $ c>。
解决方案
(defun foo()
-to-debug-log错误。函数终止。(第n 1(回溯帧2))))
(defun foo ()
(send-to-debug-log "Error. Function terminated." (get-current-function-name)))
I currently do this:
(defun foo ()
(send-to-debug-log "Error. Function terminated." 'foo)))
Hard coding the function name seems not to be a good practice.
Any suggestion to implement the get-current-function-name
or get-function-name-that-call-me
.
解决方案
(defun foo ()
(send-to-debug-log "Error. Function terminated." (nth 1 (backtrace-frame 2))))
这篇关于有没有办法获取当前函数的函数名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文