Date
1 - 4 of 4
Logging
Archiloque <code@...>
Hi,
for the moment rest-client has a very ad-hockish logging mechanism, see http://github.com/archiloque/rest-client/blob/1.2.0/lib/restclient/request.rb#L254 how it currently works: - you can specify a log by calling RestClient.log= - if the log is 'stdout', the log will be done to stdout - same for stderr - anything else will be used as a filename and each logs will be appened to this file - or (for quick debugging), you can set ENV['RESTCLIENT_LOG'] (with the same values) which will take precedence on RestClient.log These features aren't currently used by the depending frameworks I know of and aren't displayed on the project' documentation. My issue : I (and ngw) think the current code is a hack and would like the library to use a stdlib Logger so it would work more nicely with calling code. So can you tell me if you use the existing features and your opinion about them ? Possible solutions: - many of you use the existing code, then I'll add the logger as another specific case - some of you use the existing code but you agree it's a hack, then I could move the existing code in an external file as a monkey patch (so including the file would make the code work the same) - nobody use it exept for debugging and you all agree a logger is a no brainer A.
|
|
Adam Wiggins <adam@...>
I definitely agree that the logger could use some attention. My only
request would be to preserve the ability to activate it with an environment variable - I use this ALL the time and it is incredibly useful for introspecting command-line tools that use RestClient. (e.g. heroku, taps, ey-flex) For example: $ RESTCLIENT_LOG=stdout heroku list RestClient.get "https://api.heroku.com/apps", "User-Agent"=>"heroku-gem/1.6.0", "X-Heroku-API-Version"=>"2" # => 200 OK | application/xml 3487 bytes I also think it's worth preserving the format, which is valid ruby code. There's a great segment about why this is useful in James Edward Grey's talk from Mountainwest Rubyconf: http://mwrc2009.confreaks.com/13-mar-2009-10-30-littlebigruby-james-edward-grey-ii.html The segment on restclient starts at 6:45, and he talks about logging at 10:25. Adam
|
|
code@...
I definitely agree that the logger could use some attention. My onlyI forgot about the embedding case for the environment, and I agree about the format. A.
|
|
Cyril Rohr <cyril.rohr@...>
Hi,
toggle quoted messageShow quoted text
+1 I would go with the backwards compatible version. The recommended way to do it would be: RestClient.log = Logger.new(STDOUT, ...) and we would have a specific case to handle string values ('stdout', 'stderr', 'filename') and create the corresponding logger objects. Old clients would still work without any change (I think this is very important since I use the logging facility quite often in my own clients), and new/updated clients would be able to start using a "real" logging facility. To encourage the move to the new system, we may display deprecation warnings (displayed as ruby comments) when a string is passed as an argument to the RestClient.log= function. Cyril
On Jan 3, 2010, at 11:57 PM, Archiloque wrote:
Hi,
|
|