Last change
on this file since 1892 was
1572,
checked in by Henrik Bettermann, 18 years ago
|
Uli's new log file viewer
|
File size:
801 bytes
|
Rev | Line | |
---|
[1572] | 1 | ## Script (Python) "getLogData" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters= |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | """ |
---|
| 11 | return logfile entries |
---|
| 12 | """ |
---|
| 13 | |
---|
| 14 | wtool = context.waeup_tool |
---|
| 15 | |
---|
| 16 | # Default values... |
---|
| 17 | filename = "event.log" |
---|
| 18 | numlines = 30 |
---|
| 19 | |
---|
| 20 | # Validate posted vars... |
---|
| 21 | request = container.REQUEST |
---|
| 22 | if 'filename' in request.keys(): |
---|
| 23 | if request['filename'] in ['event.log','Z2.log']: |
---|
| 24 | filename = request['filename'] |
---|
| 25 | |
---|
| 26 | if 'numlines' in request.keys(): |
---|
| 27 | try: |
---|
| 28 | reqlines = int(request['numlines']) |
---|
| 29 | if reqlines > 0 and reqlines < 1000: |
---|
| 30 | numlines = reqlines |
---|
| 31 | except: |
---|
| 32 | pass |
---|
| 33 | |
---|
| 34 | return { 'filename' : filename, |
---|
| 35 | 'numlines' : numlines, |
---|
| 36 | 'lines' : wtool.getLogfileLines(filename, numlines) |
---|
| 37 | } |
---|
Note: See
TracBrowser for help on using the repository browser.