Skip to content

Instantly share code, notes, and snippets.

View ranjanashish's full-sized avatar

Ashish Ranjan ranjanashish

  • IIT Madras
  • Chennai, India
View GitHub Profile
@ranjanashish
ranjanashish / .pre-commit-config.yaml
Last active June 23, 2018 16:47
pre-commit configuration for python projects
repos:
- repo: https://github.com/ambv/black
rev: 18.6b2
hooks:
- id: black
args: [--skip-string-normalization]
language_version: python3.6
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.3.0
hooks:
@ranjanashish
ranjanashish / log_config.py
Created June 2, 2018 03:10
log_config.py
import logging
def setup_logging(level: str) -> None:
assert level in ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'), f"Invalid log level: '{level}'"
logging.basicConfig(
level=getattr(logging, level),
format='%(asctime)s %(name)-30s %(lineno)5d %(levelname)-8s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
stream=sys.stdout,