GithubHelp home page GithubHelp logo

kean / pulse Goto Github PK

View Code? Open in Web Editor NEW
5.9K 58.0 281.0 6.63 MB

Network Logger for Apple platforms

Home Page: https://pulselogger.com

License: MIT License

Swift 99.55% Shell 0.34% Ruby 0.12%
logger networking logging ios swift macos

pulse's Introduction

promo-main

Pulse is a powerful logging system for Apple Platforms. Native. Built with SwiftUI.

Record and inspect logs and URLSession network requests right from your iOS app. Share logs and view them in Pulse Pro or use remote logging to see them in real time. Logs are stored locally and never leave your devices.

About

Pulse is not just a tool, it's a framework. It records events from URLSession or from frameworks that use it, such as Alamofire or Get, and displays them using PulseUI views that you integrate directly into your app. This way Pulse console is available for everyone who has your test builds. You or your QA team can view the logs on the device and easily share them to attach to bug reports.

Pulse is not a network proxy. If you need one, check out Proxyman.

Getting Started

The best way to start using Pulse is with the Getting Started guide. There are many ways to use it and to learn more, see the dedicated docs:

Pulse Pro

Pulse Pro is a professional macOS app that allows you to view logs in real time. The app is designed to be flexible, expansive, and precise while using all the familiar macOS patterns. It makes it easy to navigate large log files with table and text modes, filters, an all-new network inspector, JSON filters, and more.

Minimum Requirements

Pulse Swift Xcode Platforms
Pulse 4.0 Swift 5.7 Xcode 14.1 iOS 14.0, tvOS 15.0, watchOS 8.0, macOS 12.0
Pulse 3.0 Swift 5.7 Xcode 14.1 iOS 14.0, tvOS 14.0, watchOS 8.0, macOS 12.0

License

Pulse is available under the MIT license. See the LICENSE file for more info.

pulse's People

Contributors

agapovone avatar agrizzo avatar ahattalla avatar bagusandinata avatar bb9z avatar cclauss avatar damiancarrillo avatar ejensen avatar jjotaum avatar kaishin avatar kean avatar klemenkosir avatar lepips avatar mackoj avatar martindaum avatar maximality avatar mcrich23 avatar michaelhenry avatar mmmcheese avatar mr-alirezaa avatar ptxmac avatar rshanm22-ford avatar sgruby avatar slashmo avatar tahirmt avatar tbxark avatar thedavidharris avatar vdka avatar vox-humana avatar z-turk3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pulse's Issues

Is ZIPFoundation still a dependency?

I added the package but I don't see ZIPFoundation as a dependency?
Question: If any package is using ZIPFoundation, how is adding it to the project? I need to know because in my App I use ZIPFoundation as a dependency already so I'm testing Pulse in a temp project to evaluate it, I know Swift Packages with binaries can't depend on source packages.

Crash during NSURLSession.init

Application crashes during initialization NSURLSession.init inside another lib (AWS) with nil delegate. This happen 100% time only in configuration based on Release (distributed build for testing).
Use next integration approach: URLSessionProxyDelegate.enableAutomaticRegistration()

Screen Shot 2021-07-26 at 11 13 18

Regarding current version (0.15.3) sources I think this related with difference in swizzling method signature:

@objc class func pulse_init(configuration: URLSessionConfiguration, delegate: URLSessionDelegate, delegateQueue: OperationQueue?) -> URLSession {

I suggest to update signature and make delegate optional + add guard with delegate check there.

  @objc class func pulse_init(configuration: URLSessionConfiguration, delegate: URLSessionDelegate?, delegateQueue: OperationQueue?) -> URLSession {
       guard let delegate = delegate else {
           return self.pulse_init(configuration: configuration, delegate: delegate, delegateQueue: delegateQueue)
       }

       let pulseDelegate = URLSessionProxyDelegate(logger: sharedLogger, delegate: delegate)
       return self.pulse_init(configuration: configuration, delegate: pulseDelegate, delegateQueue: delegateQueue)
   }

Wrong Headers scrollview size

Found issue with scrolling in Headers tab. Seems that content size of scrollview is much bigger than the real content size (about 20-30%).

iPhone X, iOS 14.6, presented MainViewController. 100% reproduce on all requests.

IMG_70CFE23B1589

Status Code is not shown

Pulse looks like it is such an amazing network logger, but PulseUI does not show status code.
I am using Alamofire for networking.

This red circle's supposed to be fail because the network response code returns 401.
However, it is shown as Success.
IMG_0397

This image is a detailed page of above image which returns status code as 401.
As image shown, Status Code displays as -.
2

Is there any parts that I am missing?
Thank you.

M1 Mac build failure for iOS Simulator

What did you do?
Attempted to build a project for iOS simulator on an M1 Mac.

What did you expect to happen?
Build successfully

What happened instead?
Build fails
Could not find module 'Pulse' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator

Similar issue here (resolved): ReactiveX/RxSwift#2261

Questions

Hi,

Love this and have been wanting something like this for years so I'm so pleased that you've taken the time and patience to implement it (and soooo well too!)

I have a few questions as we have very strict privacy and GDPR requirements I need to satisfy before I can adopt this library.

  1. I know its backed by Apple's OSS logging framework, not OSLog โ€“ how do you recommend preventing private data from not being logged?
  2. Is it possible to prevent storing images and other non-text response data?

For more context on (2) our app allows users to upload documents to our backend but we'd never want those logged and stored. These can be (and usually are) highly sensitive documents.

Any advice or help here would be appreciated as I'd really love to adopt this ASAP!

[Question] Empty URLSessionTaskDelegate

Hi!

I really like the project and I'm giving it a try in one of mine projects. However I don't use URLSessionTaskDelegate and hence on my side I kinda don't need to provide a delegate to initialiser URLSessionโ€‹Proxyโ€‹Delegate. Why URLSessionTaskDelegate is a non-optional parameter?

Thanks :)

Support Moya?

Hi, this is awesome. Does it support moya? I tried with Experimental.URLSessionProxy.shared.isEnabled, it doesn't detect moya request. Thank you

Feature Request - Carthage Support

I'd love to see Carthage support again. I don't use SPM because I like to have all the source inside of my own repo in case something happens to the external dependencies. Up until the latest release, I was just including the PulseCore sources and things worked fine even without Carthage support. The latest release adds the PulseInternal which breaks using just the source because Core relies on Internal and won't compile.

While I can use SPM as a local package, it brings in swift-log.

I understand that SPM is the new fangled way of doing frameworks/libraries, but it doesn't afford me the control I'd like.

I'm probably alone in my request for this and I can make the local SPM work, but it isn't ideal.

Feature Request: Catalina Support

Hi, I tried to install Pulse only to find out that it's only for macOS 11 and newer. But I believe that a lot of users still use Catalina for various reasons. At least I do. So would it be possible to support at least macOS 10.15 Catalina?

Store metadata persistently

One of the swift-log parameters is metadata (key-value data). Pulse should store is persistently. It should be stored in a format which will allow efficiently queuing this metadata.

See discussion #2 (comment)

Pulse is not being updated by Xcode

Hello,

Xcode believes the next major version is 1.0.0 , so it is not updating to the newer versions of Pulse.
Is there something in package configurations that could fix that?

Captura de Tela 2022-04-28 aฬ€s 10 53 36

Crash for users with no diskspace

The NSManagedContext.save() throws an NSException which causes a crash during flush() if a users device is full.

3   CoreData                      	0x1ab5788f4 -[NSPersistentStoreCoordinator _introspectLastErrorAndThrow] + 104 (NSPersistentStoreCoordinator.m:0)
4   CoreData                      	0x1ab578f6c __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke.967 + 1256 (NSPersistentStoreCoordinator.m:0)
5   CoreData                      	0x1ab405324 -[NSPersistentStoreCoordinator _routeHeavyweightBlock:] + 260 (NSPersistentStoreCoordinator.m:598)
6   CoreData                      	0x1ab4061ec -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1260 (NSPersistentStoreCoordinator.m:3068)
7   CoreData                      	0x1ab406218 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1304 (NSPersistentStoreCoordinator.m:3672)
8   CoreData                      	0x1ab407258 -[NSManagedObjectContext save:] + 1244 (NSManagedObjectContext.m:1577)
9   AppName                 	        0x104bffb30 closure #1 in LoggerStore.flush(_:) + 244 (LoggerStore.swift:385)

Crash when the actualDelegate property of URLSessionProxyDelegate is lost

Context

Our app crashes due to the exception
[PulseCore.URLSessionProxyDelegate URLSession:didBecomeInvalidWithError:]: unrecognized selector sent to instance
when the actualDelegate is deallocated and the reference lost. This happens in our app when we open and close an UIViewController instance without letting the URLSession finish, thus causing the invalidation of that URLSession.

Explanation

In URLSessionProxyDelegate

func responds(to aSelector: Selector!) -> Bool returns true because the actualDelegate reference (e.g Alamofire.SessionDelegate) implements URLSession:didBecomeInvalidWithError:.

func forwardingTarget(for selector: Selector!) -> Any? returns nil because the actualDelegate was deallocated right after calling func responds(to aSelector: Selector!) -> Bool and the weak reference lost. (e.g when closing the view controller that triggered that network request)

Because there is no forwardingTarget to receive the message and because we claimed that URLSessionProxyDelegate can respond to the selector, [PulseCore.URLSessionProxyDelegate URLSession:didBecomeInvalidWithError:]: is called, and since it does not implements this optional delegate method, crashes.

Note

A workaround is implemented in https://github.com/toupper/Pulse by adding an empty implementation of that optional delegate method in URLSessionProxyDelegate However that is not a final solution, since it could crash for any other delegate method call.

Filter secrets from logs

A nice feature would be to provide a list of secrets that would be filtered for secure logging. For example auth tokens from headers or password parameters for signup / login calls. The ability to replace the secrets with ****** or ab*****hi would be great.

Gray area at the bottom of PulseUI MainView

Environment: iOS 15.0, iPhone 13 Pro Max and iOS 15.1, iPhone 11 Pro

If you open a particular request the area at the bottom enlarges.

I'm not familiar with SwiftUI behaviour, it could be related to it. Here we can see UISplitViewController (using lookin).

Installation guide points users to inaccessible PulseUI repo

Hi,

The installation guide located here asks users to add a package dependency with a URL of https://github.com/kean/PulseUI which requires access, now that the framework is available for free, should the documentation be updated to point to https://github.com/kean/Pulse?

PS. Thank you for your work on this project, and for providing it for free - I was looking to get all of my dependencies through SPM and this filled the last gap - network debugging, while providing the added benefit of supporting more general logging. The integration proved to be quite easy (even before URLSessionProxyDelegate.enableAutomaticRegistration(), it wasn't too difficult to get the proxy injected into AWS's Amplify framework, though it's even nicer with automatic registration).

Store invalid format for simulator-based default store

I'm trying to simply open a .pulse file from a simulator app folder. The app constantly says to me that it has Store invalid format.

Tried to debug this issue and I see a strange behaviour over saving and reading logs.
my logs are stored as ../Logs/com.github.kean.pulse/current.pulse/logs.sqlite. I see that logic for default store always uses bundle name and then adds current.pulse.

Then after I provide my path ../Logs/com.github.kean.pulse as an input to Open command it says to me the Store invalid format, but actually it fails to find a file at path ../Logs/com.github.kean.pulse/logs.sqlite, without current.pulse between sqlite and a folder.

Pulse app

I tried to fix the behaviour of an app and added current.pulse to a path.
When I provide this new path to Pulse app it gives me another error. You don't have permission to save the file "blobs" in the folder "com.github.kean.pulse". It seems to me like it shouldn't even try to save in a folder where there's no permission to do it.

Then I removed parent folder and left only ../current.pulse/logs.sqlite.

Pulse Pro app

Pulse Pro succeeds to open these logs without double parent folders. I provide it ../current.pulse folder as an input.

Save vs Read behaviour

  • default save to ../Logs/com.github.kean.pulse/current.pulse/logs.sqlite
  • default read with input ../Logs/com.github.kean.pulse tries to find ../Logs/com.github.kean.pulse/logs.sqlite

I can't provide current.pulse file with default Finder without renaming com.github.kean.pulse to something without extension to make it a folder.

It's strange to have intermediate current.pulse folder, because that makes it impossible to open folders. Or the parent folder should not have .pulse extension. That extension forces Finder to think it's an app file, not a simple folder.

Fix

I see how can I solve this in different ways, like retrying with inner *.pulse folders after failed default retrieval, but I'm not sure if it's the best decision here.

Also I see it strange no one ever struggled with this issue, because no version of Pulse.app opened logs for me before. I always use iOS in-app logs viewer with PulseUI.

It would be cool to have a live logs watcher with a simulator app on the same mac.

I would love to implement this fix, just say if I'm getting it right.

Crash on search

Hi!

Thanks for this great tool.

In the last version (1.0.1) Pulse is crashing while searching in Network tab.
You can find below some info about the crash.

NSInvalidArgumentException
unimplemented SQL generation for predicate : (text CONTAINS[cd] "rec")

Myapp // NetworkViewModel.refresh (NetworkViewModel.swift:86)
Myapp // ? (NetworkViewModel.swift:53)
Myapp // NetworkViewModel.init (<compiler-generated>)
Myapp // ? (<compiler-generated>)
Myapp //  thunk for closure (<compiler-generated>)
Called from: Combine // Subscribers.Sink.receive
Myapp // main (main.m:16)
Called from: <unknown> // <redacted>

Let me know if you need more info.

Regards, Benoit

Question: What is the recommended way to use Pulse with macOS app?

It used to be possible to use MainView inside a Mac app but in this commit it was removed c8a766a#diff-9646ff2853fe810ca8e16dddcada3ac0beb65f41bc571bc330a0da7bd394c3cb
Probably, it is expected to use PulsePro to view logs, however, all UI for enabling remote logging is also not available for Mac target. I assume it is possible to reimplement all these views and viewmodels for macOS target but seems like I am missing something here.
What's the right way to set up realtime viewer (or Pulse in general) for a macOS app?

Crash using Swizzled Automated Logging and Firebase Remote Config

Hello. I know the framework is closed-source so I can't dig deeper and debug why exactly that crash happened.

On my work project I use Firebase Remote Config instantiated with default RemoteConfig.remoteConfig() (like in docs).

That's a step after enabling swizzled Automated Logging.

The crash is a simple EXC_BAD_ACCESS:

I can make it working with manual logging, of course, but I do swizzling to log requests inside modules.

I can setup basic project to test that crash, but it would require Google-Info.plist from firebase.

The unsymbolicated part is two calls from PulseCore:

0   libswiftCore.dylib            	0x0000000190bf9110 swift_getObjectType + 40
1   PulseCore                     	0x00000001067b9bec 0x106784000 + 220140
2   PulseCore                     	0x00000001067b9bec 0x106784000 + 220140

And two pictures of what's going on inside Firebase at steps before PulseCore:
CleanShot 2021-06-11 at 14 25 36
CleanShot 2021-06-11 at 14 26 00

I'll try to setup a little project a bit later.

Make SettingsView public

I added Pulse to my project and it is working like a charm. I didn't want to use the MainView, because I would like to add the individual views from my main SettingsView. I have seen the PulseUI.SettingsView is not public, thus I am not able to add that as well. But I would need that too to enable Remote Logging. Would it be possible to make this view public?

Thanks,
Martin

Metadata isn't shown along with source info

When using PulseUI to view logs on iOS it doesn't show metadata set via logger[metadataKey: "foo"] = "bar". It also doesn't seem to be exported when exporting using a text file. The same information for #file, #function, #line isn't shown either, but they are stored in the sqlite database.

Typos discovered by codespell

$ codespell --ignore-words-list="msdos,sur"

./Pulse/CHANGELOG.md:54: dispay ==> display
./Pulse/CHANGELOG.md:107: multple ==> multiple
./Pulse/CHANGELOG.md:222: fitlers ==> filters
./Pulse/CHANGELOG.md:223: viwer ==> viewer
./Pulse/CHANGELOG.md:234: thte ==> the, that
./Pulse/CHANGELOG.md:234: descrition ==> description
./Pulse/CHANGELOG.md:272: recieves ==> receives
./Pulse/CHANGELOG.md:302: depenency ==> dependency
./Pulse/Pulse/Sources/PulseCore/ZIPFoundation/Archive.swift:118: initalizer ==> initializer
./Pulse/Pulse/Sources/PulseUI/Views/NotList.swift:31: Becuase ==> Because
./Pulse/Pulse/Sources/PulseUI/Services/LoggerSync.swift:54: deactive ==> deactivate
./Pulse/Pulse/Sources/PulseUI/Services/JSONPrinter.swift:56: indention ==> indentation
./Pulse/Pulse/Sources/PulseUI/Services/JSONPrinter.swift:79: indention ==> indentation
./Pulse/Pulse/Sources/PulseUI/Services/JSONPrinter.swift:81: indention ==> indentation
./Pulse/Pulse/Sources/PulseUI/Services/JSONPrinter.swift:94: indention ==> indentation
./Pulse/Pulse/Sources/PulseUI/Services/JSONPrinter.swift:102: indention ==> indentation
./Pulse/Pulse/Sources/PulseUI/Services/JSONPrinter.swift:131: indention ==> indentation
./Pulse/Pulse/Sources/PulseUI/Extensions/Foundation+Extensions.swift:27: occurences ==> occurrences

Failure to present file browser when ParseUI is presented

We have a UITabBarController in our app. Each tab is a UINavigationController. From one of these navigation controllers, we present the MainViewController as opposed to pushing it in order to avoid two rows of bottom tabs (one for our tab bar, and another one for the PulseUI tab bar).

Everything works fine about this approach until we try to tap the "Browse Files" button in the "Settings" tab. When we tap this button, we get the following error.

[Presentation] Attempt to present <PulseUI.DocumentBrowserViewController: 0x7fd62f58a6f0> on <UIViewController: 0x7fd62f50e650> (from <UIViewController: 0x7fd62f50e650>) which is already presenting <PulseUI.MainViewController: 0x7fd62812fa00>.

Seems to me that the MainViewController is trying to present from the presentingViewController instead of just presenting from itself. Because the presented view can present another view on top of itself, I think a possible solution for this would be to just have the instance of MainViewController present the file browser.

image

Logging messages from external package dependancy that uses swift-log

My macOS app relies on an external package (also written by me), and even if I bootstrap swift-log in my AppDelegate like so: LoggingSystem.bootstrap(PersistentLogHandler.init), log messages from the package doesn't get captured by Pulse. Is there a recommended way to achieve this, or should I also bootstrap swift-log with Pulse in the package?

Question regarding NetworkLogger implementation

Hi,

When I try to implement NetworkLogger required URLSessionTaskDelegate proxy delegate I have this issues.

This code raise Instance method 'urlSession(_:task:didReceive:completionHandler:)' nearly matches optional requirement 'urlSession(_:task:didReceive:completionHandler:)' of protocol 'URLSessionTaskDelegate'.

  public func urlSession(_ session: URLSession, task: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) {
    logger.logDataTask(task, didReceive: response)
    print("๐Ÿง™โ€โ™‚๏ธ \(#file):\(#line)")
  }

This code raise Instance method 'urlSession(_:task:didReceive:)' nearly matches optional requirement 'urlSession(_:task:didReceive:)' of protocol 'URLSessionTaskDelegate'/.

  public func urlSession(_ session: URLSession, task: URLSessionDataTask, didReceive data: Data) {
    logger.logDataTask(task, didReceive: data)
    print("๐Ÿง™โ€โ™‚๏ธ \(#file):\(#line)")
  }

Is this expected ?

More info (click to expand)
public class URLSessionDataNetworkLoggerDelegate: NSObject, URLSessionTaskDelegate {
  public let logger: NetworkLogger
  
  public init(_ logger: NetworkLogger = NetworkLogger()) {
    self.logger = logger
  }

  public func urlSession(_ session: URLSession, task: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) {
    logger.logDataTask(task, didReceive: response)
    print("๐Ÿง™โ€โ™‚๏ธ \(#file):\(#line)")
  }
  
  public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
    logger.logTask(task, didCompleteWithError: error)
    print("๐Ÿง™โ€โ™‚๏ธ \(#file):\(#line)")
  }
  
  public func urlSession(_ session: URLSession, task: URLSessionDataTask, didReceive data: Data) {
    logger.logDataTask(task, didReceive: data)
    print("๐Ÿง™โ€โ™‚๏ธ \(#file):\(#line)")
  }
  
  public func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) {
    logger.logTask(task, didFinishCollecting: metrics)
    print("๐Ÿง™โ€โ™‚๏ธ \(#file):\(#line)")
  }
}

The presentation is reset to ConsoleMessageDetailsView after adding a new log

When I investigate the details of a request (for example, the Response Body - NetworkInspectorResponseView) and a new log is added to the console (ConsoleView), the presentation returns to the details of the message (ConsoleMessageDetailsView)

Steps to reproduce:

  1. Open the message details of the latest request from the console
  2. Go to any child view from the message details (For example, Response Body)
  3. Add a new log to the console (this happens when you have long requests or periodic requests)

Expected behaviour:
The child view is visible (For example, Response Body)

Actual behaviour:
The message details is visible

Screen.Recording.2022-03-23.at.15.44.00.mov

Missing some features

Hi @kean, recently I updated version to 1.0.2. But, in ios 13 I found the search feature missing and network & settings image tab also not show. Is there really a feature that is no longer provided in iOS 13? ๐Ÿ˜ƒ

Using Apples swift-log

I love the iOS Console app. Looks like a definite time saver ๐Ÿ‘Œ

Did you already consider using apple/swift-log and writing a custom backend for Pulse (storing to CoreData) instead of writing your own top-level API?

CFBundleVersion missing in xcframework files

In Pulse / PulseUI it seems the frameworks are missing a CFBundleVersion in the Info.plist for the frameworks. Would you mind adding values in there? Looks like I can't submit my app to AppStore Connect without them having a CFBundleVersion.

Remote Loggging Question

First, thanks for this awesome too.
I followed the installation guide but I can't seem to find this step on the simulator with pulseFramwork installed on it
Remote Logging on the device with the Pulse
Am I missing something ?

Export copy create a bad file

Hi @kean,

Thanks for building Pulse. I'm trying to using it I did follow your great documentation. But there is something that I'm not sure to completely understand.

When I do this an export the file that has been exported cannot be opened by the macOS Pulse client. But when I go to the filesystem of the simulator in the /Library/Logs/com.github.kean.pulse/current.pulse this file actually is readable by the client.

Am I missing something ?

    let path = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
    if var documentPath = path.first {
      let dateString = loggerDateFormatter.string(from: env.date())
      documentPath.appendPathComponent("\(dateString).pulse")
        let logInfo = try? LoggerStore.default.copy(to: documentPath)
        try? JSONEncoder()
          .encode(logInfo)
          .write(
            to: documentPath,
            options: Data.WritingOptions.atomicWrite
          )
    }

Thanks,

Automatic Logging with Completion Handler Functions

Hey there ๐Ÿ‘‹

I've been experimenting with Pulse in the context of a non-intrusive way of debugging our network calls. Specifically I'm looking at the Automatic Logging usage method.

The guide says "Use URLSession as usual." but I'm noticing that if I use the function below then the delegate functions don't get called and thus Pulse doesn't work.

func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask

Is this expected? If so, perhaps some documentation tweaks would be useful!

I've also tried using the "Manual Integration" but I can't seem to find a nice way syntactically to capture the URLSession(Data)Task from within the completion handler to pass through to the NetworkLogger without storing a mutable task on the class.

Do you have a recommended pattern or is this the way you've been doing it?

Thanks ๐Ÿ˜„

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.