I am new to Python and learning logging technique with Decorator. For me the below code is not generating required log file. Debugged the code, getting correct message to logger statement but the file is not generating. From Test method i am call the required function where i have implemented Decorator. Please guide where i am doing mistake.
try: import csv import requests import datetime import os import sys import logging except Exception as e: print("Some Modules are missing {}".format(e)) class Meta(type): """ Meta class""" def __call__(cls, *args, **kwargs): instance = super(Meta, cls).__call__(*args, **kwargs) return instance def __init__(cls, name, base, attr): super(Meta, cls).__init__(name, base, attr) class log(object): def __init__(self, func): self.func = func def __call__(self, *args, **kwargs): """ Wrapper Function""" start = datetime.datetime.now() #start time Tem = self.func(*args) #call Function Argument = args FunName = self.func.__name__ #get Function name end = datetime.datetime.now()
没有评论:
发表评论