Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

from base_filter import BaseFilter 

 

class FastFilter(BaseFilter): 

    """ accepts only lines that have a duration that is shorter than the specified 

        parameter in ms. 

    """ 

    filterArgs = [ 

        ('--fast', {'action':'store', 'nargs':'?', 'default':False, 'type':int, 'help':'only output lines with query times shorter than FAST ms (default 1000)'}) 

    ] 

 

    def __init__(self, mlogfilter): 

        BaseFilter.__init__(self, mlogfilter 

            ) 

        if 'fast' in self.mlogfilter.args and self.mlogfilter.args['fast'] != False: 

            self.active = True 

            if self.mlogfilter.args['fast'] == None: 

                self.fastms = 1000 

            else: 

                self.fastms = self.mlogfilter.args['fast'] 

 

    def accept(self, logevent): 

        if self.active and logevent.duration: 

            return logevent.duration <= self.fastms 

        return False