From 4a51aa27c6cef369de0bc71a17bcc3bff134c547 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Sun, 2 Jul 2023 17:15:52 -0700 Subject: [PATCH] Logging improvements --- demo/default.nix | 3 +++ intake/cli.py | 3 ++- intake/source.py | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/demo/default.nix b/demo/default.nix index 4539b20..046aaa1 100644 --- a/demo/default.nix +++ b/demo/default.nix @@ -72,8 +72,10 @@ # # Exit the VM with ctrl+a x, or switch to the qemu console with ctrl+a c and `quit`. ### + ''; users.motd = '' + ### # To set a password for the web interface, run `intake passwd` and set a password. # @@ -83,5 +85,6 @@ # # Updating a source will also trigger intake to update the user crontab. If you run `crontab -l`, you should see that the `currenttime` source has a crontab entry. You can change this source's cron schedule in the source config. ### + ''; } diff --git a/intake/cli.py b/intake/cli.py index d2cf795..aea1a7a 100644 --- a/intake/cli.py +++ b/intake/cli.py @@ -122,8 +122,9 @@ def cmd_update(cmd_args): if not args.dry_run: update_items(source, items) else: + print("Update returned", len(items), "items:") for item in items: - print("Item:", item._item, file=sys.stderr) + print(" Item:", item._item, file=sys.stderr) except InvalidConfigException as ex: print("Could not fetch", args.source, file=sys.stderr) print(ex, file=sys.stderr) diff --git a/intake/source.py b/intake/source.py index 1f74c42..e544919 100755 --- a/intake/source.py +++ b/intake/source.py @@ -197,7 +197,7 @@ def _read_stdout(process: Popen, output: list) -> None: while True: data = process.stdout.readline() if data: - print(f"[stdout] <{repr(data)}>", file=sys.stderr) + print(f"[stdout] {data.rstrip()}", file=sys.stderr) output.append(data) if process.poll() is not None: break @@ -211,7 +211,7 @@ def _read_stderr(process: Popen) -> None: while True: data = process.stderr.readline() if data: - print(f"[stderr] <{repr(data)}>", file=sys.stderr) + print(f"[stderr] {data.rstrip()}", file=sys.stderr) if process.poll() is not None: break