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

Allow disabling timestamps with colored output #400

Merged
merged 1 commit into from
Jan 6, 2017

Conversation

carolynvs
Copy link
Contributor

When using colored output, DisableTimestamps doesn't work.

Sample Application

package main

import "github.com/Sirupsen/logrus"

func main() {
    l := logrus.New()
    l.Formatter = &logrus.TextFormatter{
        DisableTimestamp: true,
        ForceColors:      true,
    }

    l.Info("I'm a little teapot")
}

Expected Output

INFO I'm a little teapot

Actual Output

INFO[0000] I'm a little teapot

@cdrage
Copy link

cdrage commented Nov 16, 2016

I'm experiencing the same issue. I disable time stamp and with colours, and I'm still getting [0000].

ping @sirupsen ?

@stevvooe
Copy link
Collaborator

LGTM

Rebuilding.

@jonathan-robertson
Copy link
Contributor

Wow, how'd I miss this? I made a duplicate pull request in #427 (am closing mine now)

👍 wish I'd noticed your PR first

@stevvooe
Copy link
Collaborator

stevvooe commented Jan 6, 2017

@sirupsen PTAL

@stevvooe stevvooe merged commit 9b48ece into sirupsen:master Jan 6, 2017
carolynvs added a commit to carolynvs/carina that referenced this pull request Jan 6, 2017
Use upstream logrus now that sirupsen/logrus#400
has been merged
carolynvs added a commit to carolynvs/carina that referenced this pull request Feb 2, 2017
Use upstream logrus now that sirupsen/logrus#400
has been merged
@carolynvs carolynvs deleted the disable-color-timestamp branch February 7, 2017 19:02
@cdrage
Copy link

cdrage commented Mar 31, 2017

@carolynvs @sirupsen

EDIT: DISREGARD! Vendoring screwed up miraculously so I didn't have the latest commit. Issue has been solved.

Uh oh. This seems to have crept back in.

Despite setting:

    formatter := new(log.TextFormatter)                                                                                                                                                                                                                                           
    formatter.DisableTimestamp = true                                                                                                                                                                                                                                             
    formatter.ForceColors = true                                                                                                                                                                                                                                                  
    log.SetFormatter(formatter) 

I'm getting [0000] again as a timestamp.

FATA[0000] No 'docker-compose' file found: stat docker-compose.yaml: no such file or directory 

I'll see what commit caused this!

cgxxv pushed a commit to cgxxv/logrus that referenced this pull request Mar 25, 2022
Allow disabling timestamps with colored output
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.

5 participants