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

colored labels output for logcli #2470

Merged
merged 2 commits into from
Aug 8, 2020

Conversation

adityacs
Copy link
Contributor

@adityacs adityacs commented Aug 6, 2020

What this PR does / why we need it:
Adds support to logcli for colored labels in default output mode. Includes the 16 colors output(black, white and blue excluded). Most of the terminals should support this.

Screenshot 2020-08-06 at 1 16 16 PM

This should be just the initial version. Later versions can include 256 colors and the user input based coloring.

Which issue(s) this PR fixes:
Fixes #2260

Checklist

  • Documentation added
  • Tests updated

@codecov-commenter
Copy link

codecov-commenter commented Aug 6, 2020

Codecov Report

Merging #2470 into master will increase coverage by 0.01%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2470      +/-   ##
==========================================
+ Coverage   62.92%   62.94%   +0.01%     
==========================================
  Files         162      162              
  Lines       13981    13990       +9     
==========================================
+ Hits         8798     8806       +8     
- Misses       4496     4497       +1     
  Partials      687      687              
Impacted Files Coverage Δ
pkg/logcli/output/default.go 78.57% <0.00%> (-21.43%) ⬇️
pkg/logcli/query/query.go 0.00% <ø> (ø)
pkg/logcli/output/output.go 91.66% <100.00%> (+2.77%) ⬆️
pkg/logql/evaluator.go 92.88% <0.00%> (+0.40%) ⬆️

@@ -198,6 +198,7 @@ Flags:
--store-config="" Execute the current query using a configured storage from a given Loki configuration file.
-t, --tail Tail the logs
--delay-for=0 Delay in tailing by number of seconds to accumulate logs for re-ordering
--colored-output Show ouput with colored labels
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add periods to all the descriptions in this list.

Copy link
Member

@owen-d owen-d left a comment

Choose a reason for hiding this comment

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

Cool addition :)

@pull-request-size pull-request-size bot added size/L and removed size/M labels Aug 8, 2020
@owen-d owen-d merged commit 68568f1 into grafana:master Aug 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

logcli: a way to color log lines based on labels or pattern matching
4 participants