Remote Logger
Project description
Remote Logger
Installation
pip install remote-logger
Examples
Initializing RemoteLogger with Sentry
import logging
from remote_logger.clients.sentry_logger_client import SentryLoggerClient
from remote_logger.remote_logger_handler import RemoteLoggerHandler
LOGGER = logging.getLogger(__name__)
dsn = "https://<key>@sentry.io/<project>"
sentry_client = SentryLoggerClient(dsn=dsn)
sentry_handler = RemoteLoggerHandler(client=sentry_client)
sentry_handler.setLevel(logging.ERROR)
LOGGER.addHandler(sentry_handler)
Initializing RemoteLogger with Stackdriver
import logging
from remote_logger.clients.stackdriver_logger_client import StackdriverLoggerClient
from remote_logger.remote_logger_handler import RemoteLoggerHandler
LOGGER = logging.getLogger(__name__)
# With service key
service_key_path = "/path/to/key.json"
stackdriver_client = StackdriverLoggerClient(service_key_path=service_key_path)
# Without service key
stackdriver_client = StackdriverLoggerClient()
stackdriver_handler = RemoteLoggerHandler(stackdriver_client)
stackdriver_handler.setLevel(logging.ERROR)
LOGGER.addHandler(stackdriver_handler)
Sending events to RemoteLogger
dummy_group_id = 99
primary_metadata = {
"pkey1": "pvalue1",
"pkey2": "pvalue2",
"pkey3": "pvalue3",
}
secondary_metadata = {
"skey1": "svalue1",
"skey2": "svalue2",
"skey3": "svalue3",
}
LOGGER.error("Test Message", extra={
"group_id": dummy_group_id,
"primary_metadata": primary_metadata,
"secondary_metadata": secondary_metadata,
})
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
remote-logger-0.3.1.tar.gz
(4.8 kB
view details)
Built Distribution
File details
Details for the file remote-logger-0.3.1.tar.gz
.
File metadata
- Download URL: remote-logger-0.3.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 179f1f9bcc1e22f5260da175103bf04be732b4a3a188fc0c424cae34a39320e8 |
|
MD5 | 5a30dea35754a2d9364c2bdb433f9f68 |
|
BLAKE2b-256 | 646b0075d00d11aa985f669a725f8b2bf9210f883182db18976360a1bb3544a1 |
File details
Details for the file remote_logger-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: remote_logger-0.3.1-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 094d352ee1cb61e09139deebaf25b422962f2b78e4efd9bdf998081adc95607f |
|
MD5 | ebc2eafd51b05a811f92a17b4e43ffc0 |
|
BLAKE2b-256 | 7cd6a51c4edd318daf5a872b35a65ed4daa04785e72b06a1ef3634d29ef4493c |