Swiftpack.co - Logomorph/iOSNetworkLogger as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Logomorph.
Logomorph/iOSNetworkLogger 1.1.0
Log messages from Swift to a Node.js server for debugging
⭐️ 2
🕓 3 years ago
.package(url: "https://github.com/Logomorph/iOSNetworkLogger.git", from: "1.1.0")

NetworkLogger

Log messages to a node.js server for debugging

Overview

I made this while implementing background upload and download in iOS apps, in order to easily log messages when testing background completions. Suports both ios and macos.

It supports swift only, it can't log from Objective-C. The log method supports the same arguments as the print method, so you can log as usual.

Prerequisites

  1. Install Node.js: https://nodejs.org/en/download/
  2. The Node.js server needs the ip module to work. It's used for printing the local ip when the server starts. In order to install it, run:
npm install ip

From source

  1. Add Sources/NetworkLogger/NetworkLogger.swift to you project

Swift package manager

  1. Add the git url as a swift package

Usage

  1. Start the server by running node server.js from the terminal
  2. If using SPM, import NetworkLogger
  3. Set NL.serverIP to your desired IP address. The default is https://127.0.0.1:8080. Make sure to include the port!
  4. Call NL.log("message") to log a message to the server
  5. A new entry should appear in the terminal running the server

GitHub

link
Stars: 2
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

1.1.0
3 years ago

Added MacOS support

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics