This is how you can manage and share logs in iOS application.

Related tags

Logging swift_logger
Overview

Logging in Swift

In this example, you can find how to print all the logs effciently in iOS application. Along with, you will find how to share logs for debuging purpose.

By share logs, you can ask to your app user to share logs as a file so that you can debug any issue.

Example: How to print logs

You can print logs for different categories like error, info, warning, debug, verbose.

Log.p(#function, type: .info)
Log.p("this is log to test log level: error", type: .error)
Log.p("this is log to test log level: warn", type: .warn)
Log.p("this is log to test log level: info", type: .info)
Log.p("this is log to test log level: debug", type: .debug)
Log.p("this is log to test log level: verbose", type: .verbose)

Example: How to share log file

if let logFilePath = Log.fileLogger.currentLogFileInfo?.filePath {
    DispatchQueue.main.async {
    	let fileUrl = URL(fileURLWithPath: logFilePath)
	    let activityViewController = UIActivityViewController(activityItems: [fileUrl], applicationActivities: nil)
        self.present(activityViewController, animated: true) { }
    }
}

Example: How to log Networking request and response:

While you deal with networking requests and responses in your application, you need to logs all the request and response. In Logger.swift file, you will find two seperate methods to do that.

Log.logStartRequest(request: URLRequest) // For request
Log.logEndRequest(response: URLResponse>, data: Data?, error: Error?) // For response

I hope you find this repository useful. Do not forgot to follow me for more updates.

Contact Me:

Feel free to reach out if you have questions or if you want to contribute in any way:

You might also like...
XCLog is a Swift extension that helps you print something in console when debugging your projects.

XCLog XCLog is a Swift extension that helps you print something in console when debugging your projects. Installation Open Xcode File Add Packages

TraceLog is a highly configurable, flexible, portable, and simple to use debug logging system for Swift and Objective-C applications running on Linux, macOS, iOS, watchOS, and tvOS.

Please star this github repository to stay up to date. TraceLog Introduction TraceLog is a highly configurable, flexible, portable, and simple to use

Elegant and extensive logging facility for OS X & iOS (includes database, Telnet and HTTP servers)

Overview XLFacility, which stands for Extensive Logging Facility, is an elegant and powerful logging facility for OS X & iOS. It was written from scra

Easy to use and lightweight logger for iOS, macOS, tvOS, watchOS and Linux in Swift.
Easy to use and lightweight logger for iOS, macOS, tvOS, watchOS and Linux in Swift.

Lighty Easy to use and lightweight logger for iOS, macOS, tvOS, watchOS and Linux in Swift. Screenshots Requirements Lighty Version Minimum iOS Target

A lightweight Swift logger, uses `print` in development and `NSLog` in production. Support colourful and formatted output.
A lightweight Swift logger, uses `print` in development and `NSLog` in production. Support colourful and formatted output.

Loggerithm A lightweight Swift logger, uses print in Debug and NSLog in Production with colourful output. Why In Swift, we usually use print to log in

In-App iOS Debugging Tool With Enhanced Logging, Networking Info, Crash reporting And More.
In-App iOS Debugging Tool With Enhanced Logging, Networking Info, Crash reporting And More.

The debugger tool for iOS developer. Display logs, network request, device informations, crash logs while using the app. Easy accessible with its bubble head button 🔘 . Easy to integrate in any apps, to handle development or testing apps easier. First version, there is plenty of room for improvement.

Monitor and terminate/throttle CPU hogging processes in iOS

Vedette Monitor and terminate/throttle CPU hogging processes in iOS Vedette is a CPU usage monitoring tweak for processes in iOS like apps and daemons

A fast & simple, yet powerful & flexible logging framework for Mac and iOS
A fast & simple, yet powerful & flexible logging framework for Mac and iOS

CocoaLumberjack CocoaLumberjack is a fast & simple, yet powerful & flexible logging framework for macOS, iOS, tvOS and watchOS. How to get started Fir

JustLog brings logging on iOS to the next level. It supports console, file and remote Logstash logging via TCP socket with no effort. Support for logz.io available.
JustLog brings logging on iOS to the next level. It supports console, file and remote Logstash logging via TCP socket with no effort. Support for logz.io available.

JustLog JustLog takes logging on iOS to the next level. It supports console, file and remote Logstash logging via TCP socket with no effort. Support f

Comments
Owner
Nitin Aggarwal
iOS Developer | Swift | Objective-C | Learner | Creative | Blogger
Nitin Aggarwal
Styling and coloring your XCTest logs on Xcode Console

XLTestLog Notes with Xcode 8 and XLTestLog Since Xcode 8 killed XcodeColors, the current way using XCTestLog on Xcode 8 is just plain texts with emoji

Xaree Lee 58 Feb 2, 2022
Simply, Logify provides instant colorful logs to improve log tracking and bug tracing

Logify Simply, Logify provides instant colorful logs to improve log tracking and bug tracing. Why I need to use Logify? As discussed before in a lot o

Furkan KAPLAN 13 Dec 28, 2022
📱💬🚦 TinyConsole is a micro-console that can help you log and display information inside an iOS application, where having a connection to a development computer is not possible.

TinyConsole TinyConsole is a tiny log console to display information while using your iOS app and written in Swift. Usage Wrap your Main ViewControlle

Devran Cosmo Uenal 2k Jan 3, 2023
Log messages to text files and share them by email or other way.

LogToFiles How to log messages to text files and share them by email or share center. 1 - Add the Log.swift file to your App 2 - Just log the messages

Miguel Chaves 0 Jan 9, 2022
Allow users to easily share Diagnostics with your support team to improve the flow of fixing bugs.

Example mail composer Example Report Diagnostics is a library written in Swift which makes it really easy to share Diagnostics Reports to your support

WeTransfer 768 Dec 22, 2022
LogDog is designed to work out of the box, you can use the pre-configured logger anytime, anywhere

LogDog user-friendly logging apple/swift-log api compatible Usage LogDog is designed to work out of the box, you can use the pre-configured logger any

Luo Xiu 21 Aug 14, 2022
Simple Design for Swift bridge with Javascript. Also can get javascript console.log.

SDBridgeOC is here. If your h5 partner confused about how to deal with iOS and Android. This Demo maybe help. YouTube video is here. bilibili Video is

null 20 Dec 28, 2022
DotsTest - Create a little Record application and using Pinata for API

Technical Test Create a little Record application and using Pinata for API. The

budain 0 Dec 31, 2021
SecFit (Secure Fitness) is a hybrid mobile application for fitness logging.

SecFit SecFit (Secure Fitness) is a hybrid mobile application for fitness logging. Deploy with Docker Prerequisites: Docker Git Windows hosts must use

Erik Turøy Midtun 0 Oct 22, 2021