Skip to content

ui / logger: rethink verbosity #2329

@ghost

Description

Here's an old idea that I wanted to experiment with but never made time for it 😅 , now feel like sharing and spark some discussion :)

The output of some commands narrate what is happening underneath, this is awesome for someone curious that wants to take a peek behind the curtain, but might result tiring such verbosity when you already know (or just don't care) what the command did. Let's take dvc add for example:

$ dvc add hello

Saving 'hello' to '.dvc/cache/b1/946ac92492d2347c6235b4d2611184'.
Saving information to 'hello.dvc'.

My suggestion would be to create different verbose levels, -vvv (INFO, DEBUG, DATABASE?) and make the output of the first level serve the purpose to know what's going on:

==> Adding 'hello' file...
  -> computing checksum: b1946ac92492d2347c6235b4d261118
  -> moving file to cache '.dvc/cache/b1/946ac92492d2347c6235b4d261118'
  -> linking '.dvc/cache/b1/946ac92492d2347c6235b4d261118' to 'hello'
  -> generate stage file 'hello.dvc'

There are different levels to group operations:

:: H1
==> H2
  -> Content
  ---> SQL queries in case that we need those? Maybe information about inodes?

>> prompt

Creating some flexibility on how to organize the output so it make sense

:: Add (command / operation)
==> foo (file / target)
  -> Stuff about adding foo
==> bar
  -> Stuff about adding bar

Arrows might be a little bit confusing but if you add some color they look really great:
(the idea is taken from the way pacman/yay organizes its output).

Notice the bold on the headers that represent operations occurring during an update:
2019-07-27-13:52:39

Also notice that they are not masking the outputs of the download, probably was a curl)
2019-07-27-13:57:40

We can keep the color code for warnings/errors:
2019-07-27-14:01:27.

This can integrate very well with progress bar.

Possible implementation

  • Keep track of the indentation level on the Logger itself
  • Modify the -v so you can express the level of verbosity with several ones -vvv

The cool part of it is that it would make it clearer (even for the ones working with the code) to inspect what's going on when running a command, the downside is that we will need to organize the code in such way that these operations are possible 😅

Metadata

Metadata

Assignees

Labels

uiuser interface / interaction

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions