Capture iOS application logs and save it to a file

Is there a way to capture the iOS application logs and store it to a file? like capturing the logs with adb logcat command in android?

I tried using idevicesyslog and --showiOSlogs, the first one seems to be broken and doesnt show me the logs and the second one, shows me all the logs but the application’s

Any method to have it? I have mentioned in the desired capabilities like showIOSlogs set to true. Not sure on how to implement it.

Please help. I am using appium_lib client.