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

Create custom formmater #27

Open
JenneyJ opened this issue Feb 25, 2018 · 0 comments
Open

Create custom formmater #27

JenneyJ opened this issue Feb 25, 2018 · 0 comments

Comments

@JenneyJ
Copy link

JenneyJ commented Feb 25, 2018

Hi,

I've created this question in stack overflow.

https://stackoverflow.com/questions/48971780/go-change-format-of-log-output-logrus
what I need is formatting like
[INFO]:2018-02-25 10:42:20 - Starting Process
There is a simple way to do it with your lib ?

I use go logrus and I need to change the format of the output message, I try several of things without success

what I need is format like this with formatter of logrus

[error]: datetime - message

What I've tried without success is this

logger := &logrus.Logger{
Out: os.Stderr,
Level: level,
Formatter: &logrus.TextFormatter{
DisableColors: true,
TimestampFormat : "2006-01-02 15:04:05",
FullTimestamp:true,

    },
}

This produce the following

time="2018-02-25 10:42:20" level=error msg="Starting Process"

And I want it to be

[INFO]:2018-02-25 10:42:20 - Starting Process

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

No branches or pull requests

1 participant