DnV1eX / GoogleCloudLogging

Swift (Darwin) library for logging application events in Google Cloud.
Apache License 2.0
32 stars 17 forks source link

How do I upload logs immediately? #2

Closed iamgp closed 4 months ago

iamgp commented 3 years ago

In your introduction you state that logs can be uploaded in response to a given event. How do we customise this? As I am developing the app, I would like immediate upload to the backend. Currently I have the following, which works, but this obviously then removes the usefulness of the source error information that is uploaded and I suspect isn't the proper way to do it.

class CustomLogging {
    static var shared = CustomLogging()

    public func info(message: String) {
        logger.info("\(message)")
        GoogleCloudLogHandler.upload()        
    }
}

let Log = CustomLogging.shared

//somewhere else
Log.info(message:"whatever")
iamgp commented 3 years ago

@DnV1eX ?