Swiftpack.co - ericlewis/swift-log-variadic-bootstrap as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ericlewis.
ericlewis/swift-log-variadic-bootstrap 1.0.0
Variadic bootstrapping function for SwiftLog.
⭐️ 1
🕓 2 years ago
.package(url: "https://github.com/ericlewis/swift-log-variadic-bootstrap.git", from: "1.0.0")

SwiftLogVariadicBootstrap

Build & Test

Variadic bootstrap function for SwiftLog.

Basically bridges LoggingSystem.bootstrap() arguments to a MultiplexLogHandler.

Getting Started

Adding the dependency

SwiftLogVariadicBootstrap is designed for Swift 5. To use the handler, you need to declare your dependency in your Package.swift:

.package(url: "https://github.com/ericlewis/swift-log-variadic-bootstrap.git", from: "1.0.0"),

and to your application/library target, add "VariadicBootstrap" to your dependencies, e.g. like this:

.target(name: "BestExampleApp", dependencies: [
    .product(name: "VariadicBootstrap", package: "swift-log-variadic-bootstrap")
],

Example

It works exactly like the existing bootstrap function but it is variadic!

Allow the labels to be passed in via bootstrap

import Logging
import VariadicBootstrap
import ExampleLogBackend1
import ExampleLogBackend2

LoggingSystem.bootstrap(ExampleLogBackend1.init, ExampleLogBackend2.init)

Set custom labels per backend

import Logging
import VariadicBootstrap
import ExampleLogBackend1
import ExampleLogBackend2

let backend1 = ExampleLogBackend1(label: "FirstBackend")
let backend2 = ExampleLogBackend2(label: "SecondBackend")

LoggingSystem.bootstrap(backend1, backend2)

License

This library is released under the MIT license. See LICENSE for details.

GitHub

link
Stars: 1
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Release Notes

1.0.0
2 years ago

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