0

I created my own package "foo", and I am calling the functions/classes from "main.py".

I set up logging config in main.py:

import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s-%(levelname)s-%(message)s')

I have used logging in foo. I do not know how to set it up properly so that when I call foo.function() from main, I can see the logging info in foo.function. Thanks for help! in foo.py, I did:

import logging
def test_logging():
    logging.info('hi from foo!')
Lisa
  • 4,126
  • 12
  • 42
  • 71

1 Answers1

0

You should place your logging configuration in init.py file or place it in main function (see example here).

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62