Skip to content

Implement Golang SDK logger #3364

@chengxilo

Description

@chengxilo

Description

The Go SDK currently uses log.Printf for internal logging, which writes directly to stdout. This is problematic.

Component

Golang SDK 🐹

Proposed solution

(I am not a expert in logger so I believe you can come up with a better solution):

  • Define a minimal logger interface:
type Logger interface {
     Debug()
     Info()
     Error()
     Warning()
     ....
}
  • Accept it as a client option: WithLogger(logger Logger)
  • The default logger should be silent by default, but it still need to have enough feature implemented that user can use by simply modify the log level/filter, and the output stream should also be configurable.
  • Replace all log.Printf calls with c.logger.Printf, mirror the logger with rust sdk.

References

Any exellent Golang opensource project. Many of them have a logger in it :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    goPull requests that update go codegood first issueGood for newcomers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions