Optional logging?
See original GitHub issueWhen a request 404s superagent
will say “Error: Not Found”, and isn’t kind enough to tell us what it didn’t find… In our applications we have had to copy/paste node-wpapi
’s own transport API to add logging that tells us the URL of a request before it dispatches.
Ideally this could be option within the library itself, e.g. debug
option that defaults to false and is picked up in transport methods like this:
function _httpGet( wpreq, callback, debug ) {
if ( debug ) {
console.log( '[node-wpapi] GET ' + wpreq.toString() );
}
checkMethodSupport( 'get', wpreq );
// ...
}
Are you happy for me to put in a PR for this?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
How to handle logging of null values in a Java Optional chain
Second, you shouldn't log null values. If you log null values, this means that you have issues similar to NullPointerExceptions , and that...
Read more >(Optional) Logging web traffic - Amazon Simple Storage Service
An optional step to configure web traffic logging for your static website.
Read more >Optional Logging Parameters for Static Content Generation
Optional Logging Parameters for Static Content Generation ... 20 = verbose (logs each page processed with a timestamp for how long it took...
Read more >logging — Logging facility for Python — Python 3.11.1 ...
The second optional keyword argument is stack_info, which defaults to False . If true, stack information is added to the logging message, including...
Read more >Python best practice when logging optional arguments
I have a method that accepts one or more optional arguments and I'd like to log them, following the best practice of lazy...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@amitsarangi No, please go ahead!
@sdgluck That’s a pretty good idea, I’d definitely be interested in adding this. I’d probably want to read the “debug” option off of the WPReq instance, so that it can be set for a full bound WPAPI instance or for a specific instantiated WPRequest; I’d also lean towards giving the transport itself a
debug()
method that can be injected so that users can self-select forconsole.log
, or something like morgan that could integrate with their server logs, etc.