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.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

teams_logger-0.2.1-py3-none-any.whl (2.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page