Latest 0.3.0
Homepage https://github.com/Raizlabs/Slog
License MIT
Platforms ios 9.0
Authors

Swift 3.0
Version
License
Platform

A simple Swift logging library.

Basic use

Initialize with a default level, and if emojis should be included in logs:

let log = Slog(level: .warn)

Then you can log with functions for each of the log levels (with their associated emoji):

  • 📖   verbose
  • 🐝   debug
  • ✏️   info
  • ⚠️   warn
  • ⁉️   error
  • off

For example:

log.error("This is an error!")

Setting the level of a log will only print out those logs at that level or above.

log.level = .verbose

You can also initialize a log with a name. You may want to have different logs for App Lifecycle, API, UI, Data, etc. This would allow you to have different logs & set different log levels depending upon what you are trying to monitor or track down. The log name will be printed out as part of any log message for that log.

let lifeCycleLog = Slog(name:"LifeCycle", level: .verbose, useEmoji: true)

You could use this log in the AppDelegate to monitor app lifecycles. For example putting this code in didFinishLaunchingWithOptions:

lifeCycleLog.verbose("App finished launching with options (launchOptions)")

would print:

📖|LifeCycle|2017-03-23 10:55:37.193 AppDelegate.swift application(_:didFinishLaunchingWithOptions:) line 22:
App did finish launching with options: nil

You can turn off the emoji use during initialization of the log or by setting the log’s instance var useEmoji to false.

Example Project

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

Slog is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "Slog"

If you don’t want to use the check and report features, then you can use the LogOnly subspec:

pod "Slog/LogOnly"

Author

johnstricker, [email protected]

License

Slog is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Slog",
    "version": "0.3.0",
    "summary": "Simple Swift logging",
    "description": "Simple swift logging",
    "homepage": "https://github.com/Raizlabs/Slog",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "johnstricker": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Raizlabs/Slog.git",
        "tag": "0.3.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "Slog/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This