MCPcopy
hub / github.com/InternLM/lmdeploy / FilterDuplicateWarning

Class FilterDuplicateWarning

lmdeploy/utils.py:84–110  ·  view source on GitHub ↗

Filter the repeated warning message. Args: name (str): name of the filter.

Source from the content-addressed store, hash-verified

82
83
84class FilterDuplicateWarning(logging.Filter):
85 """Filter the repeated warning message.
86
87 Args:
88 name (str): name of the filter.
89 """
90
91 def __init__(self, name: str = 'lmdeploy'):
92 super().__init__(name)
93 self.seen: set = set()
94
95 def filter(self, record: LogRecord) -> bool:
96 """Filter the repeated warning message.
97
98 Args:
99 record (LogRecord): The log record.
100
101 Returns:
102 bool: Whether to output the log record.
103 """
104 if record.levelno != logging.WARNING:
105 return True
106
107 if record.msg not in self.seen:
108 self.seen.add(record.msg)
109 return True
110 return False
111
112
113class ProcessContextFilter(logging.Filter):

Callers 1

get_loggerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected