Swiftpack.co - Package - chrisaljoudi/swift-log-oslog

LoggingOSLog

OSLog logging backend for swift-log.

Getting Started

If you're adding through Xcode's Swift Package Manager integration (Xcode 11 and higher), you can simply use:

https://github.com/chrisaljoudi/swift-log-oslog.git

And use 0.2.1 as the base version. If adding as a dependency in your Package.swift:

.package(url: "https://github.com/chrisaljoudi/swift-log-oslog.git", .from("0.2.1"))

Usage

During app startup/initialization:

import Logging
import LoggingOSLog

/// Configure `swift-log` logging system to use OSLog backend
LoggingSystem.bootstrap(LoggingOSLog.init)

Then use swift-log per usual, for example:

let logger = Logger(label: "com.yourcompany.yourawesomeapp")

/// ...

logger.info("Unified Logging is pretty cool.")

For more details on all the features of the Swift Logging API, check out the swift-log repo.

Github

link
Stars: 40

Dependencies

Used By

Total: 0

Releases

swift-log-oslog 0.2.1 - 2019-12-23 07:05:10

What’s new

This is a minor release with an important fix to how Strings are cast before being passed to os_log and some metadata fixes—namely Package.swift and extension @availability annotations.

Thanks to @rhysforyou and @vdka for contributing those metadata fixes!

Also, with this release, swift-log-os-log officially adopts the Apache 2.0 license (thanks to @ktoso for filing #4).

Upgrading

Since this is a minor dot release, if you used ‘Up to Next Major’ from 0.1.0 when depending on swift-log-oslog through Xcode (or .from("0.1.0") in Package.swift), then simply updating to latest package versions through Xcode/SwiftPM should bring you up to 0.2.1.