Skip to content

Instantly share code, notes, and snippets.

@podhmo podhmo/Makefile
Last active Jan 8, 2020

Embed
What would you like to do?
from handofcats import as_command
import logging
logger = logging.getLogger(__name__)
@as_command
def hello(*, name: str = "world") -> None:
logger.debug("DEBUG")
logger.info(f"hello {name}")
logger.warning("WARN")
00:
python hello.py
01:
python hello.py -h
02:
python hello.py --logging=INFO
03:
DEBUG=1 python hello.py
04: LEVEL ?= DEBUG
04: FORMAT ?= {"level": "%(levelname)s", "funcname": "%(funcName)s", "message": "%(message)r"}
04: STREAM ?= stdout
04:
LOGGIG_FORMAT=${STREAM} LOGGING_FORMAT='${FORMAT}' LOGGING_LEVEL=${LEVEL} python hello.py
05:
DEBUG=1 python -m handofcats ./messages.py:debug
import logging
logger = logging.getLogger(__name__)
def debug():
logger.debug("DEBUG")
def info():
logger.info("INFO")
def warning():
logger.warning("WARNING")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.