source: WAeUP_SRP/trunk/skins/waeup_default/grepLog.py @ 9821

Last change on this file since 9821 was 5564, checked in by Henrik Bettermann, 14 years ago

Search log files online.

  • Property svn:keywords set to Id
File size: 981 bytes
Line 
1## Script (Python) "grepLog"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=searchstring='', filename='event.log'
8##title=
9##
10"""
11return logfile entries
12"""
13
14import logging
15logger = logging.getLogger('Skins.grepLog')
16mtool = context.portal_membership
17member = mtool.getAuthenticatedMember()
18
19wtool = context.waeup_tool
20
21request = context.REQUEST
22response = request.RESPONSE
23
24def rwrite(s):
25    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
26    response.write(s)
27
28
29loglines = wtool.grepLog(filename,searchstring)
30
31if not loglines:
32    return
33
34logger.info('%s searched %s' % (member,filename))
35
36#from Products.zdb import set_trace
37#set_trace()
38
39rwrite("--------- grep '%s' %s ----------<br />\r\n" % (searchstring,filename)) 
40for line in loglines:
41    if not 'ConflictError' in line:
42        rwrite("%s<br />\r\n" %line)
43rwrite("--------- end ----------<br />\r\n")       
Note: See TracBrowser for help on using the repository browser.