Swiftpack.co - janodev/log as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by janodev.
janodev/log 1.0.0
Log handler for Swift-Log
⭐️ 1
🕓 2 years ago
iOS
.package(url: "https://github.com/janodev/log.git", from: "1.0.0")

Swift

A simple log utility.

[networking] Client.request(resource:co…: 40 · 200 GET https://randomuser.me/api/?results=1&inc=name&seed=abc
[networking]    ReportTests.testFormat():102 · 200 GET https://domain.com/api?1=2
  • It aligns the method name so it is easy to scan.
  • It doesn’t print elements that are useless in the Xcode console, like the full timestamp and project name.
  • It includes a character · you can use in the Xcode console to filter out OS_Activity garbage and multiline logs.

Installation

dependencies: [
    .package(name: "log", url: "https://github.com/janodev/log.git", from: "1.0.0")
],
targets: [
    .target(
        name: "SomeTarget",
        dependencies: [
            .product(name: "LogDynamic", package: "log")
        ],
// ...

Configuration

Define this as a top level variable (outside any object):

let log = PrintLogger(label: "networking", logLevel: .trace)

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics