]>
code.delx.au - pymsnt/blob - src/debug.py
1 # Copyright 2004-2005 James Bunton <james@delx.cjb.net>
2 # Licensed for distribution under the GPL version 2, check COPYING for details
4 from twisted
.python
import log
12 def __init__(self
, category
=INFO
, ident
="", msg
="", log
=True):
13 self
.category
, self
.ident
, self
.msg
= category
, ident
, msg
14 frame
= sys
._getframe
(1)
15 self
.klass
= frame
.f_locals
.get("self", frame
.f_code
.co_filename
)
16 self
.method
= frame
.f_code
.co_name
17 self
.args
= frame
.f_locals
23 for key
in self
.args
.keys():
28 args
[key
] = "Oversize arg"
30 # If its not an object with length, assume that it can't be too big. Hope that's a good assumption.
32 category
= str(self
.category
).split(".")[1]
33 return "%s :: %s :: %s :: %s :: %s :: %s" % (category
, str(self
.ident
), self
.msg
, self
.method
, str(self
.klass
), str(args
))