source: fedd/Makefile/federation/list_log.py @ 88e7f2f

version-3.01version-3.02
Last change on this file since 88e7f2f was 88e7f2f, checked in by Ted Faber <faber@…>, 14 years ago

version bump

  • Property mode set to 100644
File size: 517 bytes
Line 
1#!/usr/local/bin/python
2
3from threading import Lock
4
5class list_log:
6    """
7    Provide an interface that lets logger.StreamHandler s write to a list
8    of strings.
9    """
10    def __init__(self, l=[]):
11        """
12        Link to an existing list or just create a log
13        """
14        self.ll = l
15        self.lock = Lock()
16    def write(self, str):
17        """
18        Add the string to the log.  Lock for consistency.
19        """
20        self.lock.acquire()
21        self.ll.append(str)
22        self.lock.release()
23
24    def flush(self):
25        """
26        No-op that StreamHandlers expect
27        """
28        pass
Note: See TracBrowser for help on using the repository browser.