Back to index

plone3  3.1.7
Functions | Variables
CMFPlacefulWorkflow.Log Namespace Reference

Functions

def Log
def FormatStack
def LogException
def LogFile
def LogzLog

Variables

string __version__ = "$Revision: 36863 $"
 CMFPlacefulWorkflow Copyright (C)2006 Ingeniweb.
string __docformat__ = 'restructuredtext'
int LOG_LEVEL = 1
int LOG_NONE = 0
int LOG_CRITICAL = 1
int LOG_ERROR = 2
int LOG_WARNING = 3
int LOG_NOTICE = 4
int LOG_DEBUG = 5
list LOG_STACK_DEPTH = [-2]
string pr = "%8s %s%s: "
 return "%s(%s)"%( os.path.basename(stackItem[0]), stackItem[1] ) pr = "%s %s %010.02f %08d/%02d > " % (LOG_LABEL[level], time.ctime(time.time()), time.clock(), thread.get_ident(), threading.activeCount())
 data = data
 thread.get_ident(), threading.activeCount()
 LOG_OUTPUT = stderr
tuple logger = logging.getLogger('CMFPlacefulWorkflow')
dictionary zLogLevelConverter
dictionary LOG_PROCESSOR
dictionary LOG_LABEL

Function Documentation

FormatStack(stack) => string

Return a 'loggable' version of the stack trace

Definition at line 99 of file Log.py.

00099 
00100 def FormatStack(stack):
00101     """
00102     FormatStack(stack) => string
00103     
00104     Return a 'loggable' version of the stack trace
00105     """
00106     ret = ""
00107     for s in stack:
00108         ret = ret + "%s:%s:%s: %s\n" % (os.path.basename(s[0]), s[1], s[2], s[3])
00109     return ret
00110 

def CMFPlacefulWorkflow.Log.Log (   level,
  args,
  kw 
)
Log(level, *args, **kw) => Pretty-prints data on the console with additional information.
Use a STACK_OFFSET paramter to lower the stack depth

Definition at line 63 of file Log.py.

00063 
00064 def Log(level, *args, **kw):
00065     """
00066     Log(level, *args, **kw) => Pretty-prints data on the console with additional information.
00067     Use a STACK_OFFSET paramter to lower the stack depth
00068     """
00069     if LOG_LEVEL and level <= LOG_LEVEL:
00070         if not level in LOG_PROCESSOR.keys():
00071             raise ValueError, "Invalid log level :", level
00072 
00073         stack = ""
00074         stackItems = traceback.extract_stack()
00075         for depth in LOG_STACK_DEPTH:
00076             stackItem = stackItems[depth - kw.get('STACK_OFFSET', 0)]
            stack = "%s%s:%s:" % (stack, os.path.basename(stackItem[0]), stackItem[1],)

Here is the caller graph for this function:

LogException () => None

Print an exception information on the console

Definition at line 111 of file Log.py.

00111 
00112 def LogException():
00113     """
00114     LogException () => None
00115 
00116     Print an exception information on the console
00117     """
00118     s = StringIO.StringIO()
00119     Log(LOG_NOTICE, "EXCEPTION >>>", STACK_OFFSET = 1)
00120     traceback.print_exc(file = s, )
00121     s.seek(0)
00122     Log(LOG_NOTICE, s.read())
00123     Log(LOG_NOTICE, "<<< EXCEPTION", STACK_OFFSET = 1)
00124 

Here is the call graph for this function:

def CMFPlacefulWorkflow.Log.LogFile (   level,
  label,
  data,
  stack 
)
LogFile : writes data to the LOG_OUTPUT file.

Definition at line 126 of file Log.py.

00126 
00127 def LogFile(level, label, data, stack):
00128     """
00129     LogFile : writes data to the LOG_OUTPUT file.
00130     """
00131     LOG_OUTPUT.write(data+'\n')
00132     LOG_OUTPUT.flush()
00133 

def CMFPlacefulWorkflow.Log.LogzLog (   level,
  label,
  data,
  stack 
)
LogzLog : writes data though Zope's logging facility

Definition at line 146 of file Log.py.

00146 
00147 def LogzLog(level, label, data, stack):
00148     """
00149     LogzLog : writes data though Zope's logging facility
00150     """
00151     logger.log(zLogLevelConverter[level], data)
00152 
00153     


Variable Documentation

string CMFPlacefulWorkflow.Log.__docformat__ = 'restructuredtext'

Definition at line 41 of file Log.py.

string CMFPlacefulWorkflow.Log.__version__ = "$Revision: 36863 $"

CMFPlacefulWorkflow Copyright (C)2006 Ingeniweb.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Definition at line 38 of file Log.py.

thread.get_ident(), threading.activeCount()

Definition at line 89 of file Log.py.

Definition at line 48 of file Log.py.

Definition at line 52 of file Log.py.

Definition at line 49 of file Log.py.

Initial value:
00001 {
00002     LOG_NONE: "",
00003     LOG_CRITICAL: "CRITICAL",
00004     LOG_ERROR:    "ERROR   ",
00005     LOG_WARNING:  "WARNING ",
00006     LOG_NOTICE:   "NOTICE  ",
00007     LOG_DEBUG:    "DEBUG   ",
00008     }

Definition at line 164 of file Log.py.

Definition at line 45 of file Log.py.

Definition at line 47 of file Log.py.

Definition at line 51 of file Log.py.

Definition at line 125 of file Log.py.

Initial value:
00001 {
00002     LOG_NONE: LogzLog,
00003     LOG_CRITICAL: LogzLog,
00004     LOG_ERROR: LogzLog,
00005     LOG_WARNING: LogzLog,
00006     LOG_NOTICE: LogzLog,
00007     LOG_DEBUG: LogFile,
00008     }

Definition at line 154 of file Log.py.

Definition at line 61 of file Log.py.

Definition at line 50 of file Log.py.

tuple CMFPlacefulWorkflow.Log.logger = logging.getLogger('CMFPlacefulWorkflow')

Definition at line 135 of file Log.py.

string CMFPlacefulWorkflow.Log.pr = "%8s %s%s: "

return "%s(%s)"%( os.path.basename(stackItem[0]), stackItem[1] ) pr = "%s %s %010.02f %08d/%02d > " % (LOG_LABEL[level], time.ctime(time.time()), time.clock(), thread.get_ident(), threading.activeCount())

Definition at line 79 of file Log.py.

Initial value:
00001 {
00002     LOG_NONE: logging.NOTSET,
00003     LOG_CRITICAL: logging.CRITICAL,
00004     LOG_ERROR: logging.ERROR,
00005     LOG_WARNING: logging.WARNING,
00006     LOG_NOTICE: logging.INFO,
00007     LOG_DEBUG: logging.DEBUG,
00008     }

Definition at line 137 of file Log.py.