Skip to main content

Microsoft Teams logging handler for Python

Project description

Python logging handler for Microsoft Teams web hook integration with simple configuration.

Installation

pip install teams-logger

Examples

Simple

import logging
from teams_handler import TeamsHandler

th = TeamsHandler(url='YOUR_WEB_HOOK_URL', level=logging.INFO)
logging.basicConfig(handlers=[th])
logging.warning('warn message')

Using Card Formatter

import logging
from teams_handler import TeamsHandler, Office365CardFormatter

logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

th = TeamsHandler(url='YOUR_WEB_HOOK_URL', level=logging.INFO)
th.setLevel(logging.DEBUG)
logger.addHandler(th)

cf = Office365CardFormatter(facts=["name", "levelane", "lineno"])
th.setFormatter(cf)
logger.debug('debug message')
logger.info('info message')
logger.warn('warn message')
logger.error('error message')
logger.critical('critical message')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for teams-logger, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size teams_logger-0.2.0-py3-none-any.whl (2.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size teams-logger-0.2.0.tar.gz (2.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page