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

ddl, util: Add highlight to log #4861

Merged
merged 4 commits into from Oct 23, 2017

Conversation

Projects
None yet
4 participants
@zimulala
Member

zimulala commented Oct 23, 2017

I only add highlight log to highlight type.
logrus default color only supports "[loglevel]" and "file=xxx.go" fields to have colors.
I think using highlight to debug more easily. In order not to affect everyone's use, I add a new type.

@@ -110,9 +110,30 @@ func stringToLogLevel(level string) log.Level {
return defaultLogLevel
}
// logTypeToColor converts the Level to a color string.
func logTypeToColor(level log.Level) string {

This comment has been minimized.

@shenli

shenli Oct 23, 2017

Member

How about change this to func logTypeToColor(type string, level log.Level) string
If type is not "highlight", return "\033".

@shenli

shenli Oct 23, 2017

Member

How about change this to func logTypeToColor(type string, level log.Level) string
If type is not "highlight", return "\033".

This comment has been minimized.

@coocood

coocood Oct 23, 2017

Member

Only highlight need to call this function and write color code.

@coocood

coocood Oct 23, 2017

Member

Only highlight need to call this function and write color code.

This comment has been minimized.

@shenli

shenli Oct 23, 2017

Member

So why not call it logLevelToColor?

@shenli

shenli Oct 23, 2017

Member

So why not call it logLevelToColor?

@coocood

This comment has been minimized.

Show comment
Hide comment
@coocood

coocood Oct 23, 2017

Member

LGTM

Member

coocood commented Oct 23, 2017

LGTM

Show outdated Hide outdated util/logutil/log.go Outdated
@disksing

LGTM.

@zimulala zimulala merged commit 07e05e8 into pingcap:master Oct 23, 2017

4 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci-tidb/build Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

@zimulala zimulala deleted the zimulala:zimuxia/highlight branch Oct 23, 2017

shenli added a commit to shenli/tidb that referenced this pull request Oct 24, 2017

ddl, util: Add highlight to log (pingcap#4861)
* ddl, util: add highlight to log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment