Skip to content

Commit 2e97b73

Browse files
Lijiachen1018lijiachen
andauthored
[fix] logger add debug_once (#781)
## Purpose add `debug_once` interface to be compatible with vllm 0.11.0 ## Modifications - add `debug_once` interface to logger - stub the interface with `scope` keyword ## Test <img width="1345" height="475" alt="image" src="https://github.com/user-attachments/assets/a999ea0c-2adb-4187-9eb2-58c7f81ed7c2" /> Co-authored-by: lijiachen <lijiachen19@huawei.com>
1 parent ae00195 commit 2e97b73

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ucm/logger.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def format_log_msg(msg, *args) -> str:
106106
return msg % args
107107
return msg
108108

109-
def log(self, levelno, message, *args, exc_info=None):
109+
def log(self, levelno, message, *args, exc_info=None, scope=None):
110110
level = LevelMap[levelno]
111111
frame = inspect.currentframe()
112112
caller_frame = frame.f_back.f_back
@@ -142,6 +142,10 @@ def info_once(self, message: str, *args: Hashable, **kwargs: Hashable):
142142
def warning_once(self, message: str, *args: Hashable, **kwargs: Hashable):
143143
self.log(logging.WARNING, message, *args, **kwargs)
144144

145+
@lru_cache
146+
def debug_once(self, message: str, *args: Hashable, **kwargs: Hashable):
147+
self.log(logging.DEBUG, message, *args, **kwargs)
148+
145149

146150
def init_logger(name: str = "UC") -> Logger:
147151
return Logger(name)

0 commit comments

Comments
 (0)