@@ -79,13 +79,15 @@ def copy_with(self, *, logger=None, path=None, line=None, line_offset=None):
7979 new = type (self )(** kwargs )
8080 return new
8181
82- def report (self , short , * , log_level , details = None , ** log_kw ):
82+ def report (self , short , * args , log_level , details = None , ** log_kw ):
8383 """Log a report in context of the saved location.
8484
8585 Parameters
8686 ----------
8787 short : str
8888 A short summarizing report that shouldn't wrap over multiple lines.
89+ *args : Any
90+ Optional formatting arguments for `short`.
8991 log_level : int
9092 The logging level.
9193 details : str, optional
@@ -100,59 +102,75 @@ def report(self, short, *, log_level, details=None, **log_kw):
100102 location = f"{ location } :{ self .line } "
101103 extra ["src_location" ] = location
102104
103- self .logger .log (log_level , msg = short , extra = extra , ** log_kw )
105+ self .logger .log (log_level , short , * args , extra = extra , ** log_kw )
104106
105- def debug (self , short , * , details = None , ** log_kw ):
107+ def debug (self , short , * args , details = None , ** log_kw ):
106108 """Log information with context of the relevant source.
107109
108110 Parameters
109111 ----------
110112 short : str
111113 A short summarizing report that shouldn't wrap over multiple lines.
114+ *args : Any
115+ Optional formatting arguments for `short`.
112116 details : str, optional
113117 An optional multiline report with more details.
114118 **log_kw : Any
115119 """
116- return self .report (short , log_level = logging .DEBUG , details = details , ** log_kw )
120+ return self .report (
121+ short , * args , log_level = logging .DEBUG , details = details , ** log_kw
122+ )
117123
118- def info (self , short , * , details = None , ** log_kw ):
124+ def info (self , short , * args , details = None , ** log_kw ):
119125 """Log information with context of the relevant source.
120126
121127 Parameters
122128 ----------
123129 short : str
124130 A short summarizing report that shouldn't wrap over multiple lines.
131+ *args : Any
132+ Optional formatting arguments for `short`.
125133 details : str, optional
126134 An optional multiline report with more details.
127135 **log_kw : Any
128136 """
129- return self .report (short , log_level = logging .INFO , details = details , ** log_kw )
137+ return self .report (
138+ short , * args , log_level = logging .INFO , details = details , ** log_kw
139+ )
130140
131- def warn (self , short , * , details = None , ** log_kw ):
141+ def warn (self , short , * args , details = None , ** log_kw ):
132142 """Log a warning with context of the relevant source.
133143
134144 Parameters
135145 ----------
136146 short : str
137147 A short summarizing report that shouldn't wrap over multiple lines.
148+ *args : Any
149+ Optional formatting arguments for `short`.
138150 details : str, optional
139151 An optional multiline report with more details.
140152 **log_kw : Any
141153 """
142- return self .report (short , log_level = logging .WARNING , details = details , ** log_kw )
154+ return self .report (
155+ short , * args , log_level = logging .WARNING , details = details , ** log_kw
156+ )
143157
144- def error (self , short , * , details = None , ** log_kw ):
158+ def error (self , short , * args , details = None , ** log_kw ):
145159 """Log an error with context of the relevant source.
146160
147161 Parameters
148162 ----------
149163 short : str
150164 A short summarizing report that shouldn't wrap over multiple lines.
165+ *args : Any
166+ Optional formatting arguments for `short`.
151167 details : str, optional
152168 An optional multiline report with more details.
153169 **log_kw : Any
154170 """
155- return self .report (short , log_level = logging .ERROR , details = details , ** log_kw )
171+ return self .report (
172+ short , * args , log_level = logging .ERROR , details = details , ** log_kw
173+ )
156174
157175 def __post_init__ (self ):
158176 if self .path is not None and not isinstance (self .path , Path ):
0 commit comments