I am developing a custom registration program, in accordance with the requirement, I need to get the process, thread and object name. Inside the called function (In the example below, its obj must be obtained inside the get_configured_logger function) and the name of the class to which obj belongs. as shown below with comments, please give some ideas to achieve this.
import logging, logging.handlers from logging import StreamHandler, Formatter class A: def get_configured_logger(self,name): logger = logging.getLogger(name) if (len(logger.handlers) == 0): FORMAT = "%(process)s %(thread)s:-(asctime)s - %(name)s - %(levelname)s - %(message)-%(module)"
thanks
Hema
source share