27π
β
The example you link to has:
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__) #<<<<<<<<<<<<<<<<<<<<
you missed the logger
definition.
You can either put a self.logger = logging.getLogger(__name__)
in your Generic.__init__()
function, or define a global logger
right after the import as in the example.
π€GPhilo
9π
This below should be added to your code
logger=None
def setup():
logger.debug('put some text')
return 0
def main():
global logger
logger = logging.getLogger('give_some_logger_name')
logger.setLevel(logging.DEBUG)
ret = setup()
π€Chetan_Vasudevan
2π
In your class you are using logger but you have not defined it.
Either set logger like:
logger = logging.getLogger(__name__)
or use logging instead:
logging.info('Generic on file {} starts at {}'.format(file_path , time.time()))
π€Raj Shrivastawa
- Assign Value of Named URL to a Variable in Django Templates
- ValidationError while using ModelForm Django
- Python urlparse.parse_qs unicode url
- Django-rest-framework permissions for create in viewset
- Get_list_or_404 ordering in django
Source:stackexchange.com