Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
Archetypes.debug.ClassLog Class Reference
Inheritance diagram for Archetypes.debug.ClassLog:
Inheritance graph
[legend]
Collaboration diagram for Archetypes.debug.ClassLog:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def generateFrames
def munge_message
def log
def log_exc
def __call__

Public Attributes

 closeable
 target

Static Public Attributes

 last_frame_msg = None
int closeable = 0
 fp = None

Private Member Functions

def _process_frame

Detailed Description

Definition at line 83 of file debug.py.


Member Function Documentation

def Archetypes.debug.Log.__call__ (   self,
  msg 
) [inherited]

Definition at line 74 of file debug.py.

00074 
00075     def __call__(self, msg):
00076         self.log(msg)
00077 

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.debug.ClassLog._process_frame (   self,
  frame 
) [private]

Definition at line 86 of file debug.py.

00086 
00087     def _process_frame(self, frame):
00088         path = frame[1] or '<string>'
00089         index = path.find("Products")
00090         if index != -1:
00091             path = path[index:]
00092 
00093         frame = "%s[%s]:%s\n" % (path, frame[2], frame[3])
00094 
00095         return frame

Here is the caller graph for this function:

def Archetypes.debug.ClassLog.generateFrames (   self,
  start = None,
  end = None 
)

Reimplemented in Archetypes.debug.ZPTLogger.

Definition at line 96 of file debug.py.

00096 
00097     def generateFrames(self, start=None, end=None):
00098         try: 
00099             return inspect.stack()[start:end]
00100         except IndexError:
00101             # NOTE: this is required for OS-X Tiger somehow
00102             return []
00103         except TypeError:
00104             # NOTE: this is required for psyco compatibility
00105             #       since inspect.stack is broken after psyco is imported
00106             return []

Here is the caller graph for this function:

def Archetypes.debug.Log.log (   self,
  msg,
  args,
  kwargs 
) [inherited]

Reimplemented in Archetypes.debug.ZLogger.

Definition at line 62 of file debug.py.

00062 
00063     def log(self, msg, *args, **kwargs):
00064         self._open()
00065         self.fp.write("%s\n" % (self.munge_message(msg, **kwargs)))
00066         for arg in args:
00067             self.fp.write("%s\n" % pprint.pformat(arg))
00068         self._close()

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.debug.Log.log_exc (   self,
  msg = None,
  args,
  kwargs 
) [inherited]

Reimplemented in Archetypes.debug.ZLogger.

Definition at line 69 of file debug.py.

00069 
00070     def log_exc(self, msg=None, *args, **kwargs):
00071         self.log(''.join(traceback.format_exception(*sys.exc_info())), offset=1)
00072         if msg: self.log(msg, collapse=0, deep=0, *args, **kwargs)
00073 

Here is the call graph for this function:

def Archetypes.debug.ClassLog.munge_message (   self,
  msg,
  kwargs 
)
Override this to messge with the message for subclasses

Reimplemented from Archetypes.debug.Log.

Definition at line 107 of file debug.py.

00107 
00108     def munge_message(self, msg, **kwargs):
00109         deep = kwargs.get("deep", 1)
00110         collapse = kwargs.get("collapse", 1)
00111         offset   = kwargs.get("offset", 0) + 3
00112 
00113         frame = ''
00114         try:
00115             frames = self.generateFrames(offset, offset+deep)
00116             res = []
00117             for f in frames:
00118                 res.insert(0, self._process_frame(f))
00119             frame = ''.join(res)
00120         finally:
00121             try:
00122                 del frames
00123             except:
00124                 pass
00125 
00126         if collapse == 1:
00127             if frame == self.last_frame_msg:
00128                 frame = ''
00129             else:
00130                 self.last_frame_msg = frame
00131 
00132         msg = "%s%s" %(frame, msg)
00133         return msg
00134 

Here is the call graph for this function:


Member Data Documentation

int Archetypes.debug.Log.closeable = 0 [static, inherited]

Definition at line 34 of file debug.py.

Definition at line 47 of file debug.py.

Archetypes.debug.Log.fp = None [static, inherited]

Definition at line 35 of file debug.py.

Definition at line 84 of file debug.py.

Definition at line 38 of file debug.py.


The documentation for this class was generated from the following file: