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

StdLibAdapter can not extract log line with set prefix correctly #1035

Closed
soven opened this issue Nov 16, 2020 · 3 comments
Closed

StdLibAdapter can not extract log line with set prefix correctly #1035

soven opened this issue Nov 16, 2020 · 3 comments
Milestone

Comments

@soven
Copy link
Contributor

soven commented Nov 16, 2020

When using a prefix in stdlib's logger StdLibAdapter extracts the fields from log line incorrectly.

For example, the program

package main

import (
    "log"
    "os"

    gokitlog "github.com/go-kit/kit/log"
)

func main() {
    logg := log.New(gokitlog.NewStdlibAdapter(gokitlog.NewLogfmtLogger(os.Stdout)),
        "some prefix ", log.LstdFlags)
    logg.Println("log line")
}

will give us the following to the stdout:

caller="some prefix 2020/11/16 22:33" msg=":04 log line"

I have a fix to support the prefix mode by adding a method Prefix(prefix string, joinPrefixToMsg bool) StdlibAdapterOption

@ChrisHines
Copy link
Member

We would be happy to review a PR to fix this issue.

@soven
Copy link
Contributor Author

soven commented Nov 16, 2020

done

@sagikazarmark
Copy link
Contributor

Fixed in #1036

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

3 participants