Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils/logger: colorize outputs to terminal #1312

Merged
merged 3 commits into from
Jan 19, 2022
Merged

utils/logger: colorize outputs to terminal #1312

merged 3 commits into from
Jan 19, 2022

Conversation

SandyXSD
Copy link
Contributor

No description provided.

@SandyXSD SandyXSD requested a review from davies January 19, 2022 05:50
@codecov-commenter
Copy link

codecov-commenter commented Jan 19, 2022

Codecov Report

Merging #1312 (df98a17) into main (8f95046) will increase coverage by 0.02%.
The diff coverage is 38.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1312      +/-   ##
==========================================
+ Coverage   59.32%   59.34%   +0.02%     
==========================================
  Files         126      126              
  Lines       21466    21482      +16     
==========================================
+ Hits        12734    12749      +15     
+ Misses       7201     7195       -6     
- Partials     1531     1538       +7     
Impacted Files Coverage Δ
pkg/object/qingstor.go 1.14% <0.00%> (-0.03%) ⬇️
cmd/bench.go 79.87% <50.00%> (-0.46%) ⬇️
pkg/utils/logger.go 64.81% <50.00%> (-17.41%) ⬇️
pkg/chunk/disk_cache.go 79.64% <0.00%> (-0.77%) ⬇️
pkg/meta/sql.go 67.91% <0.00%> (+0.25%) ⬆️
pkg/chunk/cached_store.go 72.90% <0.00%> (+2.44%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77dda0d...df98a17. Read the comment docs.

@SandyXSD SandyXSD changed the title utils/logger: colorize outputs to terminal, and add OK level utils/logger: colorize outputs to terminal Jan 19, 2022
@SandyXSD SandyXSD marked this pull request as ready for review January 19, 2022 08:32
for i := 3; i < 6; i++ {
l.prefixes[i] = fmt.Sprintf("\033[1;%dm%s\033[0m", 30+i, ps[i])
}
l.prefixes[6] = fmt.Sprintf("\033[1;%dm%s\033[0m", 35, ps[6])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we provide a flag to disable this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better do it; but it may be conflicted with flags of subcommands, like:

./juicefs stats -h

   --nocolor          disable colors (default: false)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use it as a global option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workable

@SandyXSD SandyXSD merged commit 0a92f9d into main Jan 19, 2022
@SandyXSD SandyXSD deleted the wip-logger branch January 19, 2022 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants