[tor-bugs] #7325 [pyobfsproxy]: Scrub IPs before displaying them in logs

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Nov 20 14:41:14 UTC 2012


#7325: Scrub IPs before displaying them in logs
-------------------------+--------------------------------------------------
 Reporter:  sysrqb       |          Owner:  asn           
     Type:  defect       |         Status:  needs_revision
 Priority:  normal       |      Milestone:                
Component:  pyobfsproxy  |        Version:                
 Keywords:               |         Parent:                
   Points:               |   Actualpoints:                
-------------------------+--------------------------------------------------

Comment(by asn):

 Replying to [comment:6 sysrqb]:
 >
 > Q: In log.py, I left the log-level functions as globals but I'm
 defining/instantiating them in ObfsLogger:___init___(). I think it looks a
 little messier to retrieve the current instance of ObfsLogger, let's call
 it obfslog, and then call obfslog.debug() compared to simply log.debug().
 However, by making these globals into instance variables it leaves
 OBFSLOGGER as the only global, which I also think is advantageous.
 Furthermore, this may actually be a good idea because it is only one
 additional line to retrieve the instance but because it will affect all
 logging code I don't want to make such a change without your input.
 Thoughts?

 FWIW, I'm also not fond of the globals in log.py. Still, I think that it's
 a better solution than requiring two calls for a single logging message.

 The Python documentation in http://docs.python.org/2/howto/logging.html
 #advanced-logging-tutorial suggests to do `logger =
 logging.getLogger(__name__)` per-module, and then use `logger` through the
 module.

 This means that it would change all the `import obfsproxy.common.log as
 log` to `import logging; log = logging.getLogger('our_logger')`. Do you
 like this better? I think I do. Also, the 'our_logger' string is a bit
 awkward, maybe we should change it to 'obfslogger' or something (since its
 our main logger anyway).

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7325#comment:8>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list