RaLog

1.7.1

πŸ§™ A lightweight, highly customizable , protocol-oriented logging framework.
RakuyoKit/RaLog

What's New

1.7.1 - Xcode 15

2024-01-23T05:25:33Z

Break Change

  • The minimum supported version of iOS has been upgraded to iOS 12.

Add

  • Support visionOS.
  • Add PrivacyInfo.xcprivacy.

RaLog

δΈ­ζ–‡

RaLog is a lightweight, highly customizable, protocol-oriented logging framework.

By using the types provided by the framework, or custom management classes, you can quickly build your own logging component.

Requirements

  • iOS 12.0+ / macOS 10.14+ / tvOS 12.0+ / watchOS 5.0+
  • Swift 5.0+

Install

CocoaPods

pod 'RaLog'

Swift Package Manager

.Package(url: "https://github.com/RakuyoKit/RaLog.git", ...)

Features

  • Out of the box, easy to configure.
  • Prints objects or values like print or NSLog.
  • Provides two caching modes: disk cache and memory cache.
  • Supports filtering log by file or log category.
  • Protocol oriented, provides a very high degree of freedom to customize logging operations.
  • can be used with ColaCup to view log data visually.

Usage

For related content, see wiki: Quick Start.

Preview

The following code shows how to use RaLog for simple log printing. With this code, you will get a first look at RaLog.

More functional demos, as well as complete sample code, can be found in the demo provided with the repository (in the Examples directory).

import UIKit
import RaLog

class ViewController: UIViewController {
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        
        Log.appear(self)
    }
    
    override func viewDidDisappear(_ animated: Bool) {
        super.viewDidDisappear(animated)
        
        Log.disappear(self)
    }
    
    deinit {
        Log.deinit(self)
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        Log.debug("Note the output of the console")
        
        Log.warning("Please note that the request is about to start!😎")
        
        // Analog api request
        DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(1)) {
            
            if success {
                Log.success("request success πŸ₯³, content: api request succeeded")
                
            } else {
                Log.error("request failure 😒, error: \("some error")")
            }
        }
    }
}

When the ViewController controller is about to be accessed, the console will output the following.


[↓ In `viewDidLoad()` of ViewController.swift:32 ↓]
[RaLog] 11:17:01:353 <πŸ‘Ύ Debug> : Note the output of the console


[↓ In `viewDidLoad()` of ViewController.swift:36 ↓]
[RaLog] 11:17:01:356 <⚠️ Warning> : Please note that the request is about to start!😎


[↓ In `viewDidAppear(_:)` of ViewController.swift:16 ↓]
[RaLog] 11:17:01:370 <πŸ‘‹ Jump> : - Appear - ViewController


[↓ In `viewDidLoad()` of ViewController.swift:42 ↓]
[RaLog] 11:17:02:453 <βœ… Success> : request success πŸ₯³, content: api request succeeded

License

RaLog is available under the MIT license. For more information, see LICENSE.

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Thu Apr 25 2024 22:53:50 GMT-0900 (Hawaii-Aleutian Daylight Time)