[Core] Add Sentry logger for core cogs data gathering only (#813)

This commit is contained in:
Will
2017-06-16 14:48:00 -04:00
committed by Twentysix
parent 422bbba7f6
commit 94cfd23c00
4 changed files with 46 additions and 27 deletions

View File

@@ -5,38 +5,39 @@ from raven.handlers.logging import SentryHandler
from pathlib import Path
__all__ = ("init_sentry_logging", "should_log")
include_paths = (
'core',
'cogs.alias',
'cogs.audio',
'cogs.downloader',
'cogs.economy',
'cogs.general',
'cogs.image',
'cogs.streams',
'cogs.trivia',
'cogs.utils',
'tests.core.test_sentry',
'main',
'launcher'
)
client = None
def init_sentry_logging():
def init_sentry_logging(logger):
global client
client = Client(
dsn=("https://27f3915ba0144725a53ea5a99c9ae6f3:87913fb5d0894251821dcf06e5e9cfe6@"
"sentry.telemetry.red/19?verify_ssl=0"),
include_paths=(
'core',
'cogs.alias',
'cogs.audio',
'cogs.downloader',
'cogs.economy',
'cogs.general',
'cogs.image',
'cogs.streams',
'cogs.trivia',
'cogs.utils',
'tests.core.test_sentry',
'main',
'launcher'
),
release=fetch_git_sha(str(Path.cwd()))
)
handler = SentryHandler(client)
setup_logging(
handler,
exclude=(
"asyncio",
"discord"
)
)
logger.addHandler(handler)
def should_log(module_name: str) -> bool:
return any(module_name.startswith(path) for path in include_paths)