I have a small logging wrapper module, `test.logging`:

```python
import logging

debuglog = "debug.log"
f = open(debuglog, 'w') # truncate the file
f.close()

logger = logging.getLogger('test')
logger.setLevel(logging.INFO)

formatter = logging.Formatter(
    '%(asctime)s %(name)s %(levelname)s: %(filename)s:%(lineno)d: %(message)s')

fh = logging.FileHandler(debuglog)
fh.setLevel(logging.DEBUG)
fh.setFormatter(formatter)
logger.addHandler(fh)

def get(moduleName):
    return logging.getLogger("test." + moduleName)

```

and some modules that use it, such as `test.example`:

```python
import test.logging
logger = test.logging.get(__name__)

logger.info("This is an info message from test.example")

```

I'm wondering if there's a way to reduce the repetition of those first two lines that would appear in every submodule of `test`. I'd like to do something like:

```python
from test.logging get(__name__) as logger
logger.info("This is an info message from test.example")

```

Or even better, if I could also omit `__name__` and have `get()` automatically determine the module name. (From what I've gathered, this is possible with `inspect` module, but it can be incorrect if the caller is decorated or the program is compiled as an EXE.)

Is something like this possible?