equal
deleted
inserted
replaced
|
1 # |
|
2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of the License "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # |
|
16 |
|
17 class Refilter: |
|
18 """ |
|
19 Refilters an existing logfile with a specified filter |
|
20 |
|
21 Parameters: |
|
22 filtermodule: The name of the filter file to use for refiltering |
|
23 filtername: The name of the filter class |
|
24 logfilename: The logfile to be parsed |
|
25 """ |
|
26 class Dummy_raptor: |
|
27 def __init__(self, logfile, targets): |
|
28 self.logFileName = logfile |
|
29 self.quiet = False |
|
30 self.dummy = False |
|
31 self.targets = targets |
|
32 |
|
33 def __init__(self, filtermodule, filtername, logfilename): |
|
34 dummy_raptor = Refilter.Dummy_raptor(logfilename, []) |
|
35 |
|
36 module=__import__(filtermodule) |
|
37 self.filter=eval("module."+filtername+"()") |
|
38 |
|
39 self.filter.open(dummy_raptor) |
|
40 |
|
41 def refilter(self, inputlog): |
|
42 file=open(inputlog) |
|
43 |
|
44 while True: |
|
45 line=file.readline() |
|
46 if not line: |
|
47 break |
|
48 self.filter.write(line) |