Skip to content

Commit d724495

Browse files
grievejiafacebook-github-bot
authored andcommitted
Fix logging issue with statistics command
Reviewed By: shannonzhu Differential Revision: D30497399 fbshipit-source-id: 87a613eaf8bd31b48c51e10debd26adcbcdb26b6
1 parent 3624376 commit d724495

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

client/commands/v2/statistics.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,14 @@ def aggregate_statistics(data: StatisticsData) -> AggregatedStatisticsData:
191191
)
192192

193193

194-
def log_to_remote(logger: str, run_id: str, data: Dict[str, Any]) -> None:
194+
def log_to_remote(
195+
configuration: configuration_module.Configuration, run_id: str, data: Dict[str, Any]
196+
) -> None:
195197
def _log_fixmes(fixme_type: str, data: Dict[str, int], path: str) -> None:
196198
for error_code, count in data.items():
197-
statistics.log(
199+
statistics.log_with_configuration(
198200
statistics.LoggerCategory.FIXME_COUNTS,
199-
logger,
201+
configuration,
200202
integers={"count": count},
201203
normals={
202204
"run_id": run_id,
@@ -207,9 +209,9 @@ def _log_fixmes(fixme_type: str, data: Dict[str, int], path: str) -> None:
207209
)
208210

209211
for path, counts in data["annotations"].items():
210-
statistics.log(
212+
statistics.log_with_configuration(
211213
statistics.LoggerCategory.ANNOTATION_COUNTS,
212-
logger,
214+
configuration,
213215
integers=counts,
214216
normals={"run_id": run_id, "path": path},
215217
)
@@ -218,9 +220,9 @@ def _log_fixmes(fixme_type: str, data: Dict[str, int], path: str) -> None:
218220
for path, counts in data["ignores"].items():
219221
_log_fixmes("ignore", counts, path)
220222
for path, counts in data["strict"].items():
221-
statistics.log(
223+
statistics.log_with_configuration(
222224
statistics.LoggerCategory.STRICT_ADOPTION,
223-
logger,
225+
configuration,
224226
integers=counts,
225227
normals={"run_id": run_id, "path": path},
226228
)
@@ -251,7 +253,7 @@ def run_statistics(
251253
if log_identifier is not None
252254
else str(time.time_ns())
253255
)
254-
log_to_remote(logger, run_id, dataclasses.asdict(data))
256+
log_to_remote(configuration, run_id, dataclasses.asdict(data))
255257

256258
return commands.ExitCode.SUCCESS
257259

0 commit comments

Comments
 (0)