dapr / go-sdk

Dapr SDK for go
Apache License 2.0
446 stars 171 forks source link

Possibility to mute/implement default client logger #445

Closed chloyka closed 8 months ago

chloyka commented 1 year ago

Is your feature request related to a problem? Please describe. I think it's necessary to provide the ability to override the default logger for the client. The main issue is that in most cases, there's no need to see logs like "using traceparent..." and so on, especially in a production environment.

Even if such a need arises, in most cases, it's necessary to have the ability to customize the message format.

Describe the solution you'd like I suggest using the interface for the default logger like this:

type Logger interface {
    Printf(format string, v ...any)
    Print(v ...any)
    Println(v ...any)
    Fatal(v ...any)
    Fatalf(format string, v ...any)
    Fatalln(v ...any)
    Panic(v ...any)
    Panicf(format string, v ...any)
    Panicln(v ...any)
}

Also add setter, default logger fallback and possibility to discard logs with default logger.

PS. Can do it and make PR, because i already implemented some things

mikeee commented 8 months ago

496 now provides the requested functionality