Révision a5cc42ff modules/config_log.py
b/modules/config_log.py | ||
---|---|---|
2 | 2 |
import logging |
3 | 3 |
|
4 | 4 |
|
5 |
class ContextFilter(logging.Filter): |
|
6 |
|
|
7 |
def set_label(self, label): |
|
8 |
self.label = label |
|
9 |
|
|
10 |
def filter(self, record): |
|
11 |
|
|
12 |
record.label = self.label |
|
13 |
return True |
|
14 |
|
|
15 |
|
|
16 | 5 |
def config_log(label): |
17 | 6 |
logger = logging.getLogger(label) |
18 | 7 |
logger.setLevel(logging.INFO) |
Formats disponibles : Unified diff