Next / Previous / Contents / Shipman's homepage

13. Log.msgKind(): Send a message of a given kind

logscan.py
# - - -   L o g . m s g K i n d

    def msgKind(self, kind, *L):
        '''Send a message and tally one message of this (kind).
        '''
        #-- 1 --
        # [ log-outputs(self)  +:=  lines made from (kind)+(the
        #       concatenation of *L), broken on newlines, with
        #       each line preceded by the current prefix ]
        self.message("%s: %s" %
                       (kind, ''.join(L)))
        
        #-- 2 --
        # [ if kind is a key in self.__kindCounts ->
        #       self.__kindCounts[kind]  +:=  1
        #   else ->
        #       self.__kindCounts[kind]  :=  1 ]
        try:
            self.__kindCounts[kind] += 1
        except KeyError:
            self.__kindCounts[kind] = 1