Reputation: 5629
For the application I am making, an old-school Multi-User-Dungeon, this seems to be the best way to execute NPC-behaviour: Each NPC keeps track when it changed state for the last time, and when their perform
method is called while enough time(which might differ per NPC and current NPC state) has passed since then, the NPC will change state again.
A background Thread loops over the table of all NPCs and calls the perform
method on each of them.
My problem is this: This background thread queries ActiveRecord multiple times per second. In the development environment, all of these queries are printed to STDOUT. This makes it impossible to see what else is going on.
I would like to mute or hide the logging messages that this specific thread makes. How can this be done in Rails (4.2)?
Upvotes: 0
Views: 67
Reputation: 853
Adding a unique thread variable to your background-thread could help to identify it. Then you could conditionally log or not.
Take a look at the RoR Docs about threads
Upvotes: 1