zobayer1 / logging-extras

Python logging extensions
MIT License
8 stars 3 forks source link

Add support for os.path.expanduser for ~/ and ~username/ #9

Closed mzpqnxow closed 3 years ago

mzpqnxow commented 3 years ago

This is a small change as described in #8 that expands things like ~/somepath or ~user/somepath to the appropriate value in the same way the shell would. This uses os.path.expanduser and is very simple

I tested it with the existing support for the environment variables and didn't see any conflicts or breakage

I didn't put too much thought into the regex for this:

    _uservar_tag_matcher = re.compile(r"^~(\w*?)/")

I figure expansion should only happen for values that begin with ~ followed by alphanumeric or underscore. I wonder if the trailing slash should be optional instead of required?

zobayer1 commented 3 years ago

As a future development, I think this can be extended easily after resolving envvar values. Opened an issue with this: #16

mzpqnxow commented 3 years ago

As a future development, I think this can be extended easily after resolving envvar values. Opened an issue with this: #16

Great, thanks for accepting this and thanks again for this project