Logger - This package is a thin wrapper for `os.Logger`

Related tags

Logging Logger
Overview

Logger

This package is a thin wrapper for os.Logger.

MIT License Platform: iOS 14.0+|iPadOS 14.0+|macOS 11.0+|Mac Catalyst 14.0+|tvOS 14.0+|watchOS 7.0+| Swift: 5.5 Swift Package Manager compatible Xcode Build

Usage

  1. Define os.Logger as an extension of Logger with the property name of the string that the system uses to categorize emitted signposts.
  2. Call Logger.configure(bundleIdentifier:) to set a string that identifies the subsystem that emits signposts.
  3. Write a message to the log using os.Logger defined in "1."
import Logger

extension Logger {
    static var categoryName1: os.Logger { logger() } // The property name automatically becomes the category name
    static var categoryName2: os.Logger { logger("Category Name 2") } // Customize the category name
}

struct MyApp: App {
    init() {
        Logger.configure()
    }
    
    var body: some Scene {
        WindowGroup {
            Text("Hello, logger world!")
                .onAppear {
                    Logger.categoryName1.log(level: .info, "categoryName1's OSLogMessage")
                    // 1998-06-21 09:41:00.000000+0900 LoggerExample[88450:10207919] [categoryName1] categoryName1's OSLogMessage
                    
                    Logger.categoryName2.log(level: .info, "Category Name 2's OSLogMessage")
                    // 1998-06-21 09:41:00.000100+0900 LoggerExample[88450:10207919] [Category Name 2] Category Name 2's OSLogMessage
                    
                    Logger.categoryName1
                        .handleLogger { _ in print("some action") }
                        .log(level: .debug, "categoryName1's OSLogMessage")
                }
        }
    }
}
You might also like...
Tracker - A simple location logger app written in Swift and MVVM architecture
Tracker - A simple location logger app written in Swift and MVVM architecture

Tracker - A simple location logger app written in Swift and MVVM architecture

An Alamofire network activity logger view
An Alamofire network activity logger view

πŸ“’ AlamofireLogbook An Alamofire network activity logger view Installation AlamofireLogbook is available through CocoaPods. To install it, simply add

A simple Swift package for measuring and reporting the time taken for operations

Duration A simple Swift package for measuring and reporting the time taken for operations. It is derived from a version for Playgrounds that I blogged

A simple logging package for Swift

OhMyLog OhMyLog is a simple logging package for Swift. It supports the following features: Six logging levels ( πŸ‘£ , πŸ” , πŸ’‘ , ⚠️ , 🚨 , πŸ’Š ) Display

Thin wrapper around NSURLSession in swift. Simplifies HTTP requests.

SwiftHTTP SwiftHTTP is a thin wrapper around NSURLSession in Swift to simplify HTTP requests. Features Convenient Closure APIs Simple Queue Support Pa

Thin SwiftUI wrapper around `yt-dlp`
Thin SwiftUI wrapper around `yt-dlp`

SwiftyYTDL Thin SwiftUI wrapper around yt-dlp - popluar Python module for downloading stuff of Youtube, Twtitter, Instagram, TikTok and others. Depend

πŸ€΅πŸ½β€β™€οΈ Janet β€” A thin HTTP networking layer built on URLSession for simple, declarative endpoint specification leveraging the power of async/await.

πŸ€΅πŸ½β€β™€οΈ Janet β€” Just another networking kit β€” A thin HTTP networking layer built on URLSession for simple, declarative endpoint specification leveragi

This package gives wrapper methods for Desk360 SDK.

Desk360 (flutter sdk) This package gives wrapper methods for desk360 sdks. iOS - Android Getting started Add below code into your pubspec.yaml file un

AsyncWebSocketClient - A package that contains a client behaving as a wrapper for the URLSessionWebSocketTask

(WORK IN PROGRESS) AsyncWebSocketClient This is a package that contains a client

A fancy logger yet lightweight, and configurable. πŸ–¨
A fancy logger yet lightweight, and configurable. πŸ–¨

πŸ“£ πŸ“£ Important: Printer can only print console logs if you're running an app in the Simulator. If you're running in a real device it will not print a

Bugfender SDK for iOS, a remote logger tailor-made for mobile
Bugfender SDK for iOS, a remote logger tailor-made for mobile

Bugfender SDK for iOS Bugfender is a cloud service to collect mobile application logs. Developers can control log sending programmatically and manuall

LogDog is designed to work out of the box, you can use the pre-configured logger anytime, anywhere
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

Logger for Xcode
Logger for Xcode

CSwiftLog Usage Log.log("Message text without category") Log.my.log("Message text with custom category") Log.network.log("Message text with network ca

A custom logger implementation and Task Local helper for swift-log

LGNLog A custom logger implementation and TaskLocal helper for Swift-Log. Why and how This package provides two and a half things (and a small bonus):

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

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

Simple network activity logger for iOS
Simple network activity logger for iOS

Reqres is a simple library for logging all requests and responses in your app. It supports Alamofire and also requests made via native NSURLSession. ⬆

A network logger for iOS and macOS projects.

OkLog for iOS and macOS OkLog-Swift is a network logger written in Swift highly inspired by simonpercic's original OkLog implementation to be used in

Stock tradings Logger app for iOS
Stock tradings Logger app for iOS

Stock Logger Contributor: Name: Prof. Darren Takaki Author: Name: Ibrahim (Wusiman Yibulayin) Student ID: 0728356 Table of contents Description Gettin

Releases(0.2.0)
Owner
treastrain / Tanaka Ryoga
Swift πŸ¦… / Core NFC πŸ“Ά / Japan NFC Reader πŸ’³ / Apple Teacher with Swift Playgrounds Recognition
treastrain / Tanaka Ryoga
Bugfender SDK for iOS, a remote logger tailor-made for mobile

Bugfender SDK for iOS Bugfender is a cloud service to collect mobile application logs. Developers can control log sending programmatically and manuall

Bugfender 69 Dec 4, 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
Logger for Xcode

CSwiftLog Usage Log.log("Message text without category") Log.my.log("Message text with custom category") Log.network.log("Message text with network ca

Andrew Firsenko 2 Nov 29, 2021
A custom logger implementation and Task Local helper for swift-log

LGNLog A custom logger implementation and TaskLocal helper for Swift-Log. Why and how This package provides two and a half things (and a small bonus):

17:11 Games 0 Oct 26, 2021
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

HongHao Zhang 270 Oct 8, 2022
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

Abdullah Selek 51 Dec 21, 2022
Simple network activity logger for iOS

Reqres is a simple library for logging all requests and responses in your app. It supports Alamofire and also requests made via native NSURLSession. ⬆

Ackee 85 Aug 21, 2022
A network logger for iOS and macOS projects.

OkLog for iOS and macOS OkLog-Swift is a network logger written in Swift highly inspired by simonpercic's original OkLog implementation to be used in

Diego Trevisan Lara 18 Dec 24, 2021
Stock tradings Logger app for iOS

Stock Logger Contributor: Name: Prof. Darren Takaki Author: Name: Ibrahim (Wusiman Yibulayin) Student ID: 0728356 Table of contents Description Gettin

null 2 Jul 28, 2022
A simple logger for your swift applications.

AHQSLogger A simple logging system. Usage import AHQSLogger Use the following methods for loggging. Logging an information / debug You can log a simp

AndrΓ© Henrique da Silva 0 Dec 29, 2021