UnifiedLoggingPlus

1.1.0

Micro-framework for making OSLog more pleasant
ChimeHQ/UnifiedLoggingPlus

What's New

v1.1.0

2022-08-23T15:51:12Z
  • Safer bundle id init
  • Some basic support for Logger
  • Expanded error logging APIs

Build Status License Platforms

UnifiedLoggingPlus

Lightweight utilities for making OSLog more pleasant. Honestly, this is not a lot of code. But, it's handy and I've come to apperciate it.

Integration

Swift Package Manager:

dependencies: [
    .package(url: "https://github.com/ChimeHQ/UnifiedLoggingPlus")
]

Usage

Simple helper for Logger.

let logger = Logger(category: "MyCategory") // uses OSLog(category:)

More consise logging statements.

let log = OSLog(bundleIdScopedCategory: "MyCategory")!
let otherLog = OSLog(category: "MyCategory") // defaults to using bundle-id for scoping

log.debug("A")
log.info("B: %{public}@", value)

do {
    try thingThatThrows()
} catch {
    log.error("print error type without conversion: %{public}@", error)
}

Signpost is a simple type that encapsulates os_signpost calls, and a bunch of simple extension on OSLog.

let log = OSLog(bundleIdScopedCategory: "MyCategory")!

log.debug("concise log statements")

let result = log.signpostWithin("name") {
    // this gets measured by the signpost
}

Suggestions or Feedback

We'd love to hear from you! Get in touch via twitter, an issue, or a pull request.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Description

  • Swift Tools 5.0.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Oct 21 2024 10:38:42 GMT-0900 (Hawaii-Aleutian Daylight Time)