Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Document how to enable logging #335

jimmyz opened this Issue · 5 comments

4 participants


It appears that there is some logging built into the request library, but I can't figure out how to activate it. This would be very helpful for debugging HTTP calls.


logging in request sucks. i'm open to suggestions on how to fix.


You could use the NODE_DEBUG=request environment variable :


There is already logging code spread throughout main.js:

if (process.logging) {
  var log = process.logging('request')

And the log variable is used throughout the code. How do you set process.logging, and what type of object should it be? Actually, as I look deeper into the code, the logging probably won't give me what I want.

@mikael Ruby's rest-client has some awesome logging abilities. I really like its style of setting a logger and if the logger is set, it logs request info to the given logger.


FWIW, I hacked this together to make process.logging do something. But it doesn't really produce anything interesting ...

process.logging = ->  (args..., obj) -> 
    if args.length is 0 then console.log '******** request: ', obj; return

    log = ['******** request']
    for argStr in args
        for arg in argStr.split ' '
            if arg[0] is '%' then log.push arg[1..] + ':';  log.push obj[arg[1..]] + ', '
    console.log log...

--- and for the coffeescript-impared ----

    var __slice = [].slice;

process.logging = function() {
  return function() {
    var arg, argStr, args, log, obj, _i, _j, _k, _len, _len1, _ref;
    args = 2 <= arguments.length ?, 0, _i = arguments.length - 1) : (_i = 0, []), obj = arguments[_i++];
    if (args.length === 0) {
      console.log('******** request: ', obj);
    log = ['******** request'];
    for (_j = 0, _len = args.length; _j < _len; _j++) {
      argStr = args[_j];
      _ref = argStr.split(' ');
      for (_k = 0, _len1 = _ref.length; _k < _len1; _k++) {
        arg = _ref[_k];
        if (arg[0] === '%') {
          log.push(arg.slice(1) + ':');
          log.push(obj[arg.slice(1)] + ', ');
    return console.log.apply(console, log);

Is this still an issue?

This is so old I'm closing, if it is actually still an issue just let me know and I'll re-open.

@mikeal mikeal closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.