Add kind=(step, ) for root messages with *#973
Conversation
|
I propose to merge main logger functionality into I also propose to replace |
|
Conflicting can you rebase? |
|
@gaborbernat rebased, but there are errors now. |
This separates log semantic and representation
|
@gaborbernat fixed. I would actually prefer |
|
Indenting log lines without an origin doesn't appear semantically correct to me, nor is "step" an origin per se. The logger context attempts to accommodate both regular logging and bypassing stdlib |
src/build/__main__.py
Outdated
| _cprint('{bold}{}{reset}', fill(first, initial_indent='* '), file=sys.stderr) | ||
| for line in rest: | ||
| print(fill(line, initial_indent=' '), file=sys.stderr) | ||
| print(message, file=sys.stderr) |
There was a problem hiding this comment.
You removed fill so these lines won't be wrapped.
There was a problem hiding this comment.
Is there any software that wraps log lines itself? I always thought it is a job of a terminal/viewer.
For log analysis it is better no have output that doesn't depend on terminal width, if, for example, need one to save it for comparison later.
So why maintain this extra code if terminal already does it for us?
There was a problem hiding this comment.
If the lines are indented, then yes, they should be wrapped by the tool. That's another reason not to split these messages up.
There was a problem hiding this comment.
@layday I put the fill back and renamed log message origin to log message kind.
There was a problem hiding this comment.
fill also removes linefeeds, and it garbles multiline output.
There was a problem hiding this comment.
Tests are fixed. Should be good now.
For example, `step` is not really an origin, but a type of log message that needs to be highlighted.
|
@layday I replaced message |
This separates log semantic and representation.
Right now the first line printed with
_ctx.loggets bold is prefixed '* ', and subsequent lines in the same message are indented. This makes things more complicated than necessary. It is more convenient to just printstepmessages bold and prefixed, and plain_ctx.log(message)as plain text.