python - 메소드 이름에 대한 미리 정의된 내장 (python - predefined builtlin for method name)


문제 설명

python ‑ 메소드 이름에 대한 미리 정의된 내장 (python ‑ predefined builtlin for method name)

파이썬에서 함수 이름에 대해 미리 정의된 내장 기능이 있습니까?

예:

  1. 모듈 이름 '이름'을 미리 정의했습니다.
  2. 파일 이름 'file'에 대한 내장이 있습니다.

마찬가지로 로깅 기능에 추가하기 위해 메소드 이름에 대한 내장을 찾고 있습니다. .


참조 솔루션

방법 1:

If I get it correct, to get the function name, you can use __name__ of the function.

E.g: function_name.__name__</p>

You can find more about this over here

(by SunilSSreejith Nair)

참조 문서

  1. python ‑ predefined builtlin for method name (CC BY‑SA 2.5/3.0/4.0)

#python-logging #python-3.x






관련 질문

로깅 모듈 이상, 로그 메시지의 잘못된 표시? (Logging module weirdness, wrong display of log message?)

GCP Kubernetes의 Python 로깅 (Python logging in GCP kubernetes)

선언하기 전에 logging.info()를 호출하면 Python의 logging.basicConfig가 작동하지 않습니다. (logging.basicConfig in Python won't work if calling logging.info() before declaring)

예외 경우에 인쇄되는 오류 메시지를 사용자에게 이메일로 어떻게 보내나요? (How to send an error message being printed in an exception case by email to a user?)

Selenium-wire Python을 사용하여 네트워크 트래픽을 캡처하는 동안 다른 형식의 로그 보기 (Seeing logs in a different format while capturing network traffic using selenium-wire python)

파이썬에서는 콘솔에 로그를 쓸 수 있지만 파일에는 기록되지 않습니다. (In python I can write a log to console but its not getting written into file)

다른 모듈에서 사용자 정의 로거 처리 (Handling custom logger across different modules)

로깅 인스턴스화에 대한 Python 평가 순서입니다. 가져온 모듈이 먼저 평가되는 이유는 무엇입니까? (Python order of evaluation for a logging instantiation. Why do imported modules get evaluated first?)

X일보다 오래된 로그 파일 삭제 (Delete log files older than X days)

logging.config.fileConfig를 호출하면 로깅 시스템이 여러 번 실패합니다. (Logging system fails multiple times when I call logging.config.fileConfig)

python - 메소드 이름에 대한 미리 정의된 내장 (python - predefined builtlin for method name)

사용자 정의 클래스에서 로거를 래핑하는 동안 문제 발생 (Issue while wrapping logger in custom class)







코멘트