Hello!
As I develop Caddyfiles I often times need to output some information during the pipeline. This is information I only use during development. The way I do it today is to use respond
directives, which works fine except:
- I cannot examine whether a named matcher is matching or not
-
respond
stops execution at that point. - I only get one shot of output, it would often times be handy to output values at different points.
I have turned on debug
logging and that does not really solve the problem. The information in debug logs is too dense & crowded. And it does not display my placeholders.
I really only want to output the value of 1 or 2 placeholders at multiple places in the Caddyfile pipeline of directives.
Feature Idea: debugout
directive?
What I would really like is a debugout
directive, its only job is to take an input string and output it to stdout, no JSON, no other formatting just a string output.
E.g.:
debugout "path: {path}, myplaceholder: {myplaceholder}"
It would be important that the directive could be placed pretty much anywhere.
- inside named matcher declarations
- inside handle blocks
It would also be useful to be able to control the behavior with an environment variable:
- e.g. if
CADDY_DEBUGOUT
is set then this directive would output the strings, if not thendebugout
is aNOP
.
Feature Idea: named matcher output?
Plus, is there a way to see the value of a named matcher? e.g. just ātrueā or āfalseā (this has burned me a number of times where I thought a named matcher had a match but it was not matching anything). Here is what I do today:
@mymatcher {
...
}
handle @mymatcher {
respond "useful string of info"
}
Maybe I am messed up in the head?
Maybe something exists and I am unaware? Or maybe there are some better ābest practicesā for development?
Thanks!