axis_examplecompt_changesinfo-opsversion-3.01version-3.02
Last change
on this file since 6f02be5 was
f07fa49,
checked in by Ted Faber <faber@…>, 15 years ago
|
better logging and cleanup
|
-
Property mode set to
100644
|
File size:
517 bytes
|
Line | |
---|
1 | #!/usr/local/bin/python |
---|
2 | |
---|
3 | from threading import Lock |
---|
4 | |
---|
5 | class 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.