Skip to content

[Go] [Bug] The resty client outputs log message into stderr by default #3687

@neilotoole

Description

@neilotoole
Description

If a network error occurs, e.g. connection refused, then the resty client will use its default logger (which logs to os.Stderr) to log an error message. This is not correct behavior, as the app invoking the generated code should be the entity to decide how to log messages.

Swagger-codegen version

master

Steps to reproduce

Invoke the generated Go client, targeting an endpoint that doesn't exist. Resty will log an error to Stderr.

Suggest a Fix

Immediately: Add a line to api_client.go/ prepareClient to disable the resty logger (rClient.SetLogger(ioutil.Discard)).

Full solution: Either add LogDest io.Writerto the Configuration object, or possibly look at making the resty client instance available somehow, for anybody who might need this level of control.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions