burakoner / OKX.Api

Up-to-date, most-complete, well-organized, well-documented, easy-to-use, multi-task and multi-thread compatible OKX Cryptocurrency Exchange Rest and Websocket Api Wrapper
MIT License
39 stars 15 forks source link

How can i log errors in log file? #6

Closed overstartup closed 1 year ago

overstartup commented 1 year ago

Currently, the errors are showing in trace mode on vs.net log window. How I can change the configuration to log all errors in an external log file to check them in production?

burakoner commented 1 year ago

Try this

var okx = new OKX.Api.OKXRestApiClient(new OKX.Api.OKXRestApiClientOptions()
{
    LogWriters = new List<Microsoft.Extensions.Logging.ILogger> { logger }, // logger -> your logger object
    LogLevel = Microsoft.Extensions.Logging.LogLevel.Debug
});