You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
our developers love #wtf? and leave it in even after feature development is complete, to reproduce and debug on staging/prod what was going on, in case something fails (it happens ;-D).
Problem is, the #wtf output messes up the output of tests, particularly rspec when run in --format documentation mode, and the #wtf output can't be turned off easily at the moment.
So my request is:
allow configuring where the output of #wtf? goes -- to STDOUT by default (backwards compatibility), to a logger (i.e. allow assigning a logger that the wtf output gets sent to), or somewhere else (silencing it by setting the config to nil/false)
I think the log level should be debug or at most info
(optional) if running in Rails context, use it's logger by default
One thing I'm not so sure about is how to preserve the colorized, "ASCII-art" output of wtf in a log message. As is, will be quite hard to read and piece together if sent to a logger. In the simplest case, just make sure all of output ends up in a single log message, including the ASCII colorization codes and newlines. Then it will be fairly easy to copy out and restore. Serializing such a tree structure to a (JSON) string may be another option; but that's possible overkill and will likely be harder to read anyways. Maybe you additional ideas. What wouldn't work well is to send each line of output as a separate message, it will be hard to piece together again.
I've attached a screenshot of a typical #wtf? output for reference:
And here's the monkeypatch we currently use to silence #wtf?, as it may be helpful to others. It works in the context of a Rails application using the dotenv gem for configuration.
In RAILS_ROOT/.env:
[...]
# turn on to suppress trailblazer's wtf? output (in specs, for example)
SILENCE_TRAILBLAZER_WTF=true
In RAILS_ROOT/config/initializers/trailblazer.rb
# monkeypatch to silence the trailblazer wtf? outputmoduleTrailblazer::DevelopermoduleWtfmodule_functiondefputs(string)(ENV["SILENCE_TRAILBLAZER_WTF"] == "true") ? nil : superendendend
The text was updated successfully, but these errors were encountered:
@Drowze Thanks for your input! 🍻 We actually want to solve this problem cleanly by changing the way operations are (or should be) invoked. With endpoints, the operation is basically not called directly anymore:
# just an example, where TRB is an imaginary endpoint constantTRB._(Memo::Operation::Create,params: {herewego})
In most cases, this could be hidden, either behind Controller#run or, in a test, behind an #assert_run abstraction or your own helpers. While this might feel clumsy, it's actually much much cleaner than monkeypatching all the things.
Hey there,
our developers love #wtf? and leave it in even after feature development is complete, to reproduce and debug on staging/prod what was going on, in case something fails (it happens ;-D).
Problem is, the #wtf output messes up the output of tests, particularly rspec when run in
--format documentation
mode, and the #wtf output can't be turned off easily at the moment.So my request is:
One thing I'm not so sure about is how to preserve the colorized, "ASCII-art" output of wtf in a log message. As is, will be quite hard to read and piece together if sent to a logger. In the simplest case, just make sure all of output ends up in a single log message, including the ASCII colorization codes and newlines. Then it will be fairly easy to copy out and restore. Serializing such a tree structure to a (JSON) string may be another option; but that's possible overkill and will likely be harder to read anyways. Maybe you additional ideas. What wouldn't work well is to send each line of output as a separate message, it will be hard to piece together again.
I've attached a screenshot of a typical #wtf? output for reference:
And here's the monkeypatch we currently use to silence #wtf?, as it may be helpful to others. It works in the context of a Rails application using the dotenv gem for configuration.
In
RAILS_ROOT/.env
:[...] # turn on to suppress trailblazer's wtf? output (in specs, for example) SILENCE_TRAILBLAZER_WTF=true
In
RAILS_ROOT/config/initializers/trailblazer.rb
The text was updated successfully, but these errors were encountered: