-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogging.yaml
61 lines (61 loc) · 1.91 KB
/
logging.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# For the schema of this file, see
# https://docs.python.org/3/library/logging.config.html#logging-config-api
#
# The name of this file is unimportant, as long as you know where to load it.
version: 1
# This line is very important.
# Without this line, loggers that exist before this configuration applies
# will be disabled. (i.e. they DO NOT log anything.)
disable_existing_loggers: false
formatters:
default:
class: app.logging.SlogFormatter
format: "%(asctime)s %(levelname)s %(name)s: %(message)s"
handlers:
stderr:
class: logging.StreamHandler
formatter: default
# This handler basically logs any records that get to it.
# We rely on the level of the root logger to do the actual filtering.
level: DEBUG
stream: ext://sys.stderr
sentry_event:
class: sentry_sdk.integrations.logging.EventHandler
level: DEBUG
sentry_breadcumb:
class: sentry_sdk.integrations.logging.BreadcrumbHandler
level: INFO
otp_slack:
class: app.logging.SlackHandler
level: INFO
url: "to be set programmatically"
loggers:
# Gunicorn has default logging config and it MERGES the user-provided config
# with its own one.
# Since we have defined our own formatters and handlers,
# we must also re-defined the gunicorn loggers so that they DO NOT reference
# formatters and handlers in the default logging config.
gunicorn.access:
# Turn off the access log.
propagate: false
handlers: []
gunicorn.error:
# To stderr only.
level: INFO
propagate: false
handlers: [stderr]
app.payment:
# But we want to log INFO or above from app.payment.
level: INFO
testing.otp:
# In testing enviroment, we also send the OTP code to some other channel to make testing easier.
level: INFO
propagate: false
handlers: [stderr, otp_slack]
root:
# By default, log only ERROR or above.
level: ERROR
handlers:
- stderr
- sentry_event
- sentry_breadcumb