OSLogKit

<img src=”https://github.com/gokulnair2001/OSLogKit/assets/56252259/53164f76-9f0e-4dbf-8298-814424a427a0” width=20% height=20%>

OSLogKit

OSLogKit is a layer 2 framework developed on top of the native OSLog system, aiming to simplify the integration of OSLog into your project. Apple has done an excellent job in ensuring that OSLogging is straightforward and easy to use. However, when it comes to implementing OSLog in your codebase, can be challenging.

To address this, OSLogKit has been developed, further simplifying the process of adopting OSLog. One notable advantage of OSLogKit is that it offers additional functionalities not available in the native API.

OSLogKit has a variety of Modifiers which makes OSLogKit adoption very easy. Don’t worry if your code base is in UIKit, you can still adopt it quickly.

Generic badge Generic badge Generic badge Generic badge Generic badge

Demo App

📔 Usage

⚙️ Initialisation

In order to use Logger you need to initialize the instance of Logger. OSLogKit supports a variety of Initialisation

🗳 Basic Initialisation

🗳 Advance Initialisation

let logger = Logger(subSystem: "com.gokulnair.Test-OSKit", category: "ContentView")

🛠 Operations

Following are the methods which OSLogKit supports

💽 Single Capture/Logging

💽 Bulk Capturing/Logging

💽 Log Exporting

### OSLogSpan

Name Cases Description
minutes .minute(x) Considers x minutes in past
hours .hour(x) Considers x hours in past
days .day(x) Considers x days in past

### OSLogError

Name Case Description
Export Failure .exportFailure(let customString) Custom export failure error
Invalid Subsystem .invalidSubsystem Occurs when an Invalid Subsystem is used

## SwiftUI Modifiers

### 🧩 CaptureLogOnAppear

### 🧩 CaptureBulkLogOnAppear

Case Description
.captureLogOnDisappear Captures log on disappear
.captureBulkLogOnDisappear Captures bulk log on disappear
.captureLogOnLongPress Captures log on long press
.captureBulkLogOnLongPress Captures bulk log on long press
.captureLogOnTap Captures log on tap
.captureBulkLogOnTap Captures bulk log on tap
.captureLogOnSubmit Captures log on submit
.captureBulkLogOnSubmit Captures bulk log on submit

⌨️ In Code Usage

SwiftUI

 VStack {
 // Some view
 }.captureLogOnTap(logger, "OSLogKit test log") {
  // additional on tap action (Optional)
 }

UIKit

logger.capture(message: "OSLogKit test log")

⚠️ Caution

📦 SPM

OSLogKit is available through Swift Package Manager. To add OSLogKit through SPM

https://github.com/gokulnair2001/OSLogKit

<img src=”https://github.com/gokulnair2001/OSLogKit/assets/56252259/05f1688b-b62a-4114-a239-aa2f691f2e52” width=80% height=40%>

✨ Upcoming Features

⚖️ License

🪄 How to contribute?

Made with ❤️ in 🇮🇳 By Gokul Nair