Skip to content

Instantly share code, notes, and snippets.

@muya
muya / logger.py
Last active October 31, 2020 10:14
Configuring multiple loggers in a file - accompanying blog post: https://blog.muya.co.ke/configuring-multiple-loggers-python/
import logging
from logging import FileHandler
from logging import Formatter
LOG_FORMAT = (
"%(asctime)s [%(levelname)s]: %(message)s in %(pathname)s:%(lineno)d")
LOG_LEVEL = logging.INFO
# messaging logger
@muya
muya / msisdn_regex.txt
Created February 28, 2016 16:06
Regex for Safaricom Kenya, Airtel Kenya & Tigo Tanzania Phone Numbers
# KE
SAFARICOM: "/(\+?254|0|^){1}[-. ]?[7]{1}([0-2]{1}[0-9]{1}|[9]{1}[0-2]{1})[0-9]{6}\z/"
AIRTEL: "/(\+254|0|^){1}[-. ]?[7]{1}([3]{1}[0-9]{1}|[8]{1}[5-9])[0-9]{6}\z/"
# TZ
TIGO: "/(\+?255|0|^){1}[-. ]?([7]{1}[1]{1}[2-9]{1}|[6]{1}[57]{1}[2-9]{1})[0-9]{6}\z/"