Skip to content

Commit

Permalink
Merge pull request #4 from mtbutler07/feat/include-logs-in-dump
Browse files Browse the repository at this point in the history
feat: add log printing from dump
  • Loading branch information
uoodsq authored Jul 22, 2024
2 parents 0f88b43 + 1f1bce2 commit aa946df
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions moto/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,24 @@ def _ingest_upstream_channels(channels, influx, progress):
progress.update(task, advance=1)


def _print_logs(logs, progress):
table = Table(
"Timestamp",
"Level",
"Message",
title="Modem Logs",
)

for log in sorted(logs, key=lambda x: x.timestamp):
table.add_row(
log.timestamp.strftime("%Y-%m-%d %H:%M:%S"),
log.level,
log.message,
)

progress.console.print(table)


def _print_downstream_channels(channels, progress):
table = Table(
"Channel",
Expand Down Expand Up @@ -160,6 +178,9 @@ def dump():
channels = _get_upstream_channels(moto, progress)
_print_upstream_channels(channels, progress)

logs = _get_logs(moto, progress)
_print_logs(logs, progress)


def _ingest():
influx = InfluxClient()
Expand Down

0 comments on commit aa946df

Please sign in to comment.