Nukesor/pueue

[Bug] daemon version warning is written to stdout, not stderr

mjpieters opened this issue · 5 comments

Describe the bug

When client and daemon versions differ, all output except for JSON output is prepended with

Different daemon version detected '{version}'. Consider restarting the daemon.

This message is written to stdout, which means it can't easily be filtered out.

Steps to reproduce

Run the daemon as version 3.4.0, then use client version 3.4.1 and use --print-task-id to only get the task ID to be output:

$ pueue add --print-task-id 'echo hello' 2>/dev/null
Different daemon version detected '3.4.0'. Consider restarting the daemon.
1

The expected output would be 1, with Different daemon version detected '3.4.0'. Consider restarting the daemon. having been redirected to /dev/null.

Debug logs (if relevant)

No response

Operating system

Debian 10

Pueue version

3.4.0 (daemon) and 3.4.1 (client)

Additional context

At the very least, the message should be written to stderr. Ideally, it should be possible to disable it altogether (pueue --no-warnings add ...).

Thinking about it, all logs should probably be sent to stderr and the same should probably be true for pueued as well?

Thinking about it, all logs should probably be sent to stderr and the same should probably be true for pueued as well?

Hard to say. Generally speaking, 'out of band' information should go to stderr. When I run pueue log <TASKID> the goal is to get the log output of a task, so that should go to stdout. Anything else should go to stderr.

Ah yep. By logs I meant all of the stuff that's printed when pueue/d is called with -v/v/v

pueue log should definitely be put to stdout

The linked MR sends all log output to stderr and sends an error log message in case of version incompatibilities.

I'm not sure about the error-level "version incompatiblity" message though. It feels more like a warning, but the default log level is error. Maybe the default log level for the client should be bumped to warning?

Yes, that's a warning level message. What other warning-level log output could the client produce? I'd review that and bump the level to warning if there isn't too much else that'd show up.