Troubleshooting

Logging

Client-Side

You might want to know the order in which your Reflexes are called, how long it took to process each Reflex or what the Reflex response payload contains. Luckily you can enable Reflex logging to your browser's Console Inspector.
There are two ways to enable client debugging in your StimulusReflex instance.
You can provide debug: true to the initialize options like this:
app/javascript/controllers/index.js
1
StimulusReflex.initialize(application, { consumer, debug: true })
Copied!
You can also set debug mode after you've initialized StimulusReflex. This is especially useful if you just want to log the Reflex calls in your development environment:
app/javascript/controllers/index.js
1
StimulusReflex.initialize(application, { consumer })
2
if (process.env.ENVIRONMENT === 'development') StimulusReflex.debug = true
Copied!

Server-Side

To get debug logging for Sockpuppet you need to make some modifications to LOGGING in settings.py. Below you can see an example logging configuration that enables debug-level logging Sockpuppet.
1
LOGGING = {
2
'version': 1,
3
'disable_existing_loggers': False,
4
'root': {
5
'handlers': ['console'],
6
'level': 'DEBUG'
7
},
8
'handlers': {
9
'sockpuppet': {
10
'level': 'DEBUG',
11
'class': 'logging.StreamHandler',
12
'formatter': 'simple'
13
}
14
},
15
'formatters': {
16
'simple': {
17
'format': '%(levelname)s %(message)s'
18
},
19
},
20
'loggers': {
21
'sockpuppet': {
22
'level': 'DEBUG',
23
'handlers': ['sockpuppet']
24
}
25
}
26
}
Copied!
Last modified 9mo ago