NameError: global name 'logger' is not defined
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()
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()))
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.