fsprojects / FsHttp

A lightweight F# HTTP library by @SchlenkR and @dawedawe
https://fsprojects.github.io/FsHttp/
Apache License 2.0
424 stars 42 forks source link

Turning off debug logs in FSI #121

Closed naartjie closed 1 year ago

naartjie commented 1 year ago

Is there a way to turn off the debug logging in FSI?

This is my attempt which only works the 2nd time around. My guess is FsHttp's doInit only runs when the http { ... } is first called and overwrites my false to the default true again?

FsHttp.Helper.Fsi.logDebugMessages <- false

let! response =
    http {
        POST url
        body
        ContentType "text/xml"
        text reqBody
    }
    |> Request.sendAsync
SchlenkR commented 1 year ago

Hi, thanks for reporting this issue. I fixed it in 11.0.0 (and also changed the signature / namespace).

It will work like this:

do FsHttp.Fsi.disableDebugLogs()

There's a 11.0.0-preview01 available.

naartjie commented 1 year ago

Thank you @RonaldSchlenker that's amazing

SchlenkR commented 1 year ago

Thank you, too! I'll try to remember this issue the next time trying to explain why mutation in a global context can easily lead to unintended behaviour :)