Latest 1.2
Homepage https://github.com/jsloop42/JSLogger
License MIT
Platforms osx 10.9, ios 8.0
Authors

JSLogger

A simple OSLog logger library for macOS and iOS written using Swift. The library uses OSLog on macOS v10.12 and above and iOS 10.0 and above. If the OS version is lower, then it fallbacks to NSLog.

Usage

  1. Install using Cocopoads
pod 'JSLogger'
  1. Import the module and create an object or use shared instance
import JSLogger
let log = Logger()
  1. Log using various log levels
log.default("Uses the default log level from OSLog")
log.default("Is visible using Console.app as well")

log.info("Needs setting debug mode logging in Console.app")

log.debug("All logs will be displayed in Xcode debug area")

let errMsg = "Can be used for error logging"
log.error("(errMsg)")

log.fatal("Should not occur")

// Log anything
log.default([3, 1, 4, 1, 5, 9])
log.info(42)
log.debug(log)
  1. Configure logging subsytem and category
let meta = OSLog(subsystem: "com.example", category: "mysticapp")
let log = Logger(meta: meta, level: .debug)
  1. Disable all logging
log.setIsEnabled(false)
  1. Using debug level logs only if DEBUG=1 flag is set under build settings which is the default for debug builds

Latest podspec

{
    "name": "JSLogger",
    "version": "1.2",
    "license": "MIT",
    "summary": "A simple OSLog logger",
    "homepage": "https://github.com/jsloop42/JSLogger",
    "authors": {
        "jsloop": "[email protected]"
    },
    "source": {
        "git": "https://github.com/jsloop42/JSLogger.git",
        "tag": "1.2"
    },
    "documentation_url": "https://github.com/jsloop42/JSLogger",
    "platforms": {
        "osx": "10.9",
        "ios": "8.0"
    },
    "source_files": "Logger/*.swift",
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This