Latest 1.0
Homepage https://github.com/NikolaySohryakov/SwiftyOSLog
License MIT
Platforms ios 10.0, requires ARC
Authors

SwiftyOSLog

SwiftyOSLogSwiftyOSLog

About

Built on top of iOS/OS X os_log SwiftyOSLog makes use of it easy and laconic.

Features

  • Powered by os_log
  • Different logging levels: default, info, debug, error, fault
  • Supports macOS Console GUI or log comman line tool
  • Takes care of a different loggers

Installation

Using Cocoapods:

target 'MyApp' do
  pod 'SwiftyOSLog', '~> 1.0'
end

Usage

Import package

import SwiftyOSLog

Initialize logger

Use default logger

let log = SwiftyOSLog.default

or a logger for a specific subsystem and category

let subsystem = Subsystem("com.your_company.subsystem_name")
let category = Category("Chat")
let log = SwiftyOSLog(subsystem: subsystem, category: category)

or let SwiftyOSLogCoordinator manage all your loggers:

let subsystem = Subsystem.current
let category = Category.default
let log = SwiftyOSLogCoordinator.shared.log(for: subsystem, category: category)

Log

Logging mechanism is fully compatible to what’s described at Logging | Apple Developer Documentation.

Log messages should be of StaticString type:

log.info("Info message")

In case if you need a more complex message, use format specifiers described at Formatting Log Messages:

log.default("%{public}@", "Formatted message")

Respect privacy

Apple provide developers with two access modifiers: %{public} and %{private}.
Dynamic strings and complex dynammic objects are considered as prived by default and are not collected automatically. More details can be found at Privacy section of Apple Developer Documentation.

License

This library is licensed under MIT. Full license text is available in LICENSE

Latest podspec

{
    "name": "SwiftyOSLog",
    "version": "1.0",
    "summary": "A lightweight and easy to use wrapper on top of os_log.",
    "homepage": "https://github.com/NikolaySohryakov/SwiftyOSLog",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Nikolay Sokhryakov": "[email protected]"
    },
    "social_media_url": "http://twitter.com/nsohryakov",
    "platforms": {
        "ios": "10.0"
    },
    "source": {
        "git": "https://github.com/NikolaySohryakov/SwiftyOSLog.git",
        "tag": "1.0"
    },
    "source_files": "SwiftyOSLog/**/*.{swift}",
    "requires_arc": true,
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This