I'm using latest CVS (the avatar tag).  Just like to point out that it
bitches about makeAvatar:

05/19/05 - 21:46:33 - Discovery: Iq received "[EMAIL PROTECTED]" "2".
Looking for handler
05/19/05 - 21:46:36 - Traceback (most recent call last):
05/19/05 - 21:46:36 -   File
"/usr/lib/python2.3/site-packages/twisted/xish/utility.py", line 34,
in __call__
05/19/05 - 21:46:36 -     self.method(*nargs, **nkwargs)
05/19/05 - 21:46:36 -   File
"/usr/src/cvs/msn-transport/PyMSNt/src/disco.py", line 69, in onIq
05/19/05 - 21:46:36 -     self.deferredIqs[(fro, ID)].callback(el)
05/19/05 - 21:46:36 -   File
"/usr/lib/python2.3/site-packages/twisted/internet/defer.py", line
252, in callback
05/19/05 - 21:46:36 -     self._startRunCallbacks(result)
05/19/05 - 21:46:36 -   File
"/usr/lib/python2.3/site-packages/twisted/internet/defer.py", line
313, in _startRunCallbac
05/19/05 - 21:46:36 -     self._runCallbacks()
05/19/05 - 21:46:36 - --- <exception caught here> ---
05/19/05 - 21:46:36 -   File
"/usr/lib/python2.3/site-packages/twisted/internet/defer.py", line
338, in _runCallbacks
05/19/05 - 21:46:36 -     self.result = callback(self.result, *args, **kw)
05/19/05 - 21:46:36 -   File
"/usr/src/cvs/msn-transport/PyMSNt/src/session.py", line 122, in
vCardReceived
05/19/05 - 21:46:36 -     self.avatar = makeAvatar(e)
05/19/05 - 21:46:36 - exceptions.NameError: global name 'makeAvatar'
is not defined

maybe it needs to be avatar.makeAvatar?

-- 
- Norman Rasmussen
 - Email: [EMAIL PROTECTED]
 - Home page: http://norman.rasmussen.org/
From [EMAIL PROTECTED]  Fri May 20 06:00:12 2005
From: [EMAIL PROTECTED] (Lucas Nussbaum)
Date: Fri May 20 06:00:40 2005
Subject: [py-transports] Sorting out PyMSNt exceptions
Message-ID: <[EMAIL PROTECTED]>

Hi,

The attached ruby script (so you need ruby) will split your debug.log
into several dirs & files, named after the exceptions that were raised.

To use it, use :
  cat debug.log | ./PyMSNt-parser.rb

Result :
exceptions
|-- AssertionError:
|   |-- 05-16-05 - 09:26:29
|   `-- 05-17-05 - 17:16:15
|-- AttributeError: 'NoneType' object has no attribute 'contacts'
|   `-- 05-15-05 - 15:05:38
|-- AttributeError: 'NoneType' object has no attribute 'elements'
|   |-- 05-14-05 - 14:32:13
|   |-- 05-17-05 - 17:12:37
|   `-- 05-17-05 - 19:52:19
|-- AttributeError: 'NoneType' object has no attribute 'jabberID'
|   `-- 05-16-05 - 23:51:29
|-- AttributeError: 'NoneType' object has no attribute 'newResourceOnline'
|   |-- 05-16-05 - 17:52:55
|   `-- 05-18-05 - 10:09:23
|-- AttributeError: 'NoneType' object has no attribute 'notificationProtocol'
|   |-- 05-17-05 - 14:51:37
|   `-- 05-17-05 - 22:04:29
|-- AttributeError: 'NoneType' object has no attribute 'replace'
|   `-- 05-16-05 - 19:28:26
|-- AttributeError: 'NoneType' object has no attribute 
'requestSwitchboardServer'
|   |-- 05-14-05 - 23:33:01
|   |-- 05-18-05 - 02:04:24
|   `-- 05-18-05 - 09:36:10
[...]

James, if you find it useful, you can add it to PyMSNt, of course.
-- 
| Lucas Nussbaum
| [EMAIL PROTECTED]    [EMAIL PROTECTED]    GPG: 1024D/023B3F4F |
| jabber: [EMAIL PROTECTED]        http://www.lucas-nussbaum.net |
| fingerprint: 075D 010B 80C3 AC68 BD4F B328 DA19 6237 023B 3F4F |
-------------- next part --------------
#!/usr/bin/ruby -w

OUTPUTDIR="exceptions"

class LogLine
  attr_accessor :time, :text
  def initialize(text)
    t = text.split(' ',5)
    @time = t[0..2].join(' ')
    @text = (t[4] || "").chomp
  end

  def <=>(b)
    @time <=> b.time
  end
end

class LogExcep
  attr_accessor :name, :line
  def initialize(n, l)
    @name = n
    @line = l
  end
end

loglines = []
STDIN.each_line { |l| loglines << LogLine::new(l) }
loglines.sort!

logexceps = []
for i in 0...loglines.length
  if loglines[i].text =~ /^exceptions\./
    n = loglines[i].text.split(/\./,2)[1]
    logexceps << LogExcep::new(n, i)
  end
end
 
puts "#{logexceps.length} exceptions found, now outputing to #{OUTPUTDIR}"

Dir::mkdir(OUTPUTDIR) if not File::directory?(OUTPUTDIR)
logexceps.each do |e|
  dn = "#{OUTPUTDIR}/#{e.name}"
  Dir::mkdir(dn) if not File::directory?(dn)
  File::open("#{dn}/#{loglines[e.line].time.gsub('/','-')}", 'w') do |f|
    l = e.line
    bl = l
    while loglines[bl].time == loglines[l].time do
      bl -= 1
    end
    bl += 1
    loglines[bl..l].each { |l|  f.puts l.text }
  end
end

Reply via email to