russell-archer / StoreHelper

Implementing In-App Purchases with StoreKit2 in Xcode 13 - 15 using SwiftUI, Swift 5.7 - 5.9, iOS 15 - 17 and macOS 12 - 14. Also supports tvOS and visionOS.
MIT License
410 stars 48 forks source link

How to disable logs? #63

Closed Volodymyr-13 closed 1 month ago

Volodymyr-13 commented 9 months ago

Greeting from Ukraine! πŸ‡ΊπŸ‡¦

@russell-archer Thank you for this amazing project!

I just started to use it and while creating a SwiftUI views, in debug I see enormous logs like:

Request products from the App Store started
Request products from the App Store success
Request all products purchase status started
Request products from the App Store success
Request all products purchase status started
Request all products purchase status success
Request all products purchase status success

Which is really mixing with all other logs for my debug..

So I wonder, is there way to disable such logs from StoreHelper? Or maybe I'm doing something wrong if even in views where I'm not using StoreHelper I still see such logs..

russell-archer commented 9 months ago

Hi Volodymyr

Thanks for the kind words about StoreHelper - I'm really happy it's useful for you!

With regards to logging, you can somewhat reduce the amount of logging by setting StoreLog.logIsPurchasedEvents = false. For example:

struct StoreHelperDemoApp: App {
    @StateObject var storeHelper = StoreHelper()

    var body: some Scene {
        WindowGroup {
            MainView()
                .environmentObject(storeHelper)
                .task {
                    storeHelper.start()  // Start listening for transactions
                    StoreLog.logIsPurchasedEvents = false
                }
        }
    }
}

However, StoreHelper still produces quite a lot of logging!

As soon as I have some free time I'll add the ability to properly control the volume of logging!

Russell

russell-archer commented 1 month ago

Will not make these changes as I'm developing a more modern, lightweight StoreKit helper that is based around StoreKit Views. Details to follow.

Volodymyr-13 commented 1 month ago

@russell-archer Thats interesting, we actually used StoreHelper just as in-app framework, so any UI were done by us. Looking forward for lightweight StoreKit helper! Ping me when it will be available and we definitely be a first testers) for our project.