#Sentry logs are not using proper format like loguru

16 messages · Page 1 of 1 (latest)

faint zephyr
#
[REQUEST_ID] | [0.088s] | DEBUG | <MESSAGE>

In my loguru logger i use a format like this to log messages but sentry logs is completely ignoring this format

#
logger.add(
    sys.stderr,
    level="DEBUG",
    format="<cyan>[{extra[conversation_id]}]</cyan> | <yellow>[{extra[elapsed_seconds]}]</yellow> | <level>{level: <8}</level> | <level>{message}</level>{exception}",
)

I want to pass extra information in sentry logs so i can query and filter in dashboard but i dont see and i can achieve this in docs

In every log i want to pass conversation id and elapsed time which is not possible by using before_send_log because its in global scope and i want to set conversation_id on per session basis

tidal ocean
#

That feels like something we need to improve in the sdk. @faint zephyr could you open a GH issue in github.com/getsentry/sentry-python ? The maintainers can help you there

faint zephyr
#

sure, is there any workaround for now?

#

@tidal ocean

tidal ocean
#

unfortunately for now no workarounds with loguru, but we should totally make this better! I'll help raise the priority

faint zephyr
#

Using normal logger would not be possible as internally we are using loguru everywhere

#

any other workaround i just want to be able to push the convo id alteast

tidal ocean
#

you could vendor in the integration yourself and add the functionality, but beyond that we need to make sdk changes for this

jade cedar
#

(cc @jaunty jasper )

faint zephyr
#

PS: I think its a related issue but not the exact same thing