Skip to content

janodevorg/Log

Repository files navigation

Swift

A simple log utility.

Usage

let log = PrintLogger(label: "networking", logLevel: .trace)
log.debug("200 GET https://domain.com/api?1=2")

Installation

dependencies: [
    .package(url: "[email protected]:janodevorg/Log.git", from: "1.1.2")
],
targets: [
    .target(
        name: "SomeTarget",
        dependencies: [
            .product(name: "DumpLogger", package: "Log")
        ],
// ...

Output

[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 to facilitate visual scanning.
  • It doesn’t print useless elements in the Xcode console, like the full timestamp and project name.
  • It includes a · character you may use in the Xcode console to discard OS_Activity and multiline logs.
  • It logs the output of customDump when the parameter is not a string.