riverlog testing
#981
-
Currently, the River log example looks like this:
If I want to write unit tests for this code, how do I get a context with a logger attached? I couldn't find an easy way to do this in the current API. |
Beta Was this translation helpful? Give feedback.
Answered by
brandur
Jul 12, 2025
Replies: 1 comment
-
Test workers through the https://riverqueue.com/docs/testing#using-the-rivertestworker-helpers |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
bgentry
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test workers through the
rivertest.NewWorker
interface, which will add the logger context and a few other things to make the runs look as realistic as possible (make sure to include the logging middleware in the injectedNewWorker
config). See docs here:https://riverqueue.com/docs/testing#using-the-rivertestworker-helpers