A logging handler that sends you log entries on Facebook Messenger
Project description
Facebook Logger
A logging handler that sends you log entries on Facebook Messenger
import logging
from facebooklogger import FacebookLogger
logger = logging.getLogger("Home Server")
logger.setLevel(logging.INFO)
fb = FacebookLogger(level=logging.INFO)
logger.addHandler(fb)
logger.info("Server Started")
logger.warning("Something might be wrong")
logger.error("EVERYTHING IS ON FIRE")
Getting Started
Install facebooklogger with
pip install facebooklogger
To use the Facebook logger, you will need to create a Facebook page and get two pieces of information. A Page Access Token to authenticate as the page, and the User ID you want logs sent to.
Configuration
The logger requires two configuration options set:
PAGE_ACCESS_TOKEN
FB_USER_ID
They can be provided as environment variables, or by creating a file called .env
in
the working directory that looks like:
PAGE_ACCESS_TOKEN=ABCDEFGH12345abcefweeaABCDEFGH12345abcefweeaABCDEFGH12345abcefweeaABCDEFGH12345abcefweeaABCDEFGH12345abcefweeaABCDEFGH12345abcefweeaABCDEFGH12345abcefweeaABCDEFGH12345abcefwe
FB_USER_ID=1234567891234567
Replacing the token and user ID with your own obtained below
Page Access Token
Note that to use this logger you DO NOT need to have your app verified by Facebook, you can just stay in development mode.
Follow the getting started section of
https://developers.facebook.com/docs/messenger-platform/getting-started/quick-start
User ID
Facebook Page IDs are unique to the page, and as such if you change page you will need
to re-acquire the user id.
Note: You will have to already have the page access token
To get user id, run the following
PAGE_ACCESS_TOKEN=YOURTOKEN python3 -m facebooklogger
and follow the prompts
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file facebooklogger-0.2.3.tar.gz
.
File metadata
- Download URL: facebooklogger-0.2.3.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f4f2f6367ddd0c414e781d1568b6d5abe189d988cecc8cfbb1b6d4ff334a0ba |
|
MD5 | ea16477f25182f38de1688a6fd72b7bf |
|
BLAKE2b-256 | 9e3ad6e0643c762a2423a6ef39259d9f2663d45e41514913c6c0ee9191733631 |
File details
Details for the file facebooklogger-0.2.3-py3-none-any.whl
.
File metadata
- Download URL: facebooklogger-0.2.3-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9ac837f999215d1cd311ad6a9e6ab0ab068e19db0a997cb563846227f136399 |
|
MD5 | f6d5f35e18fe02fe4bbc2d52aa68cedd |
|
BLAKE2b-256 | 0e383ebb955b859270347c53d100e2880bfec4ca20ee5d52017724570aab82c2 |