Skip to content

Commit

Permalink
Drop executable target for non-macOS builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
samdeane committed Mar 16, 2021
1 parent f5c5a48 commit 6375bbc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 23 deletions.
47 changes: 27 additions & 20 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,37 @@

import PackageDescription

var products: [Product] = [
.library(
name: "Logger",
targets: ["Logger"]),
.library(
name: "LoggerUI",
targets: ["LoggerUI"]),
.library(
name: "LoggerKit",
targets: ["LoggerKit"]),
.library(
name: "LoggerTestSupport",
targets: ["LoggerTestSupport"])
]


#if os(macOS)
products.append(
.executable(
name: "LoggerExample",
targets: ["LoggerExample"]
)
)
#endif

let package = Package(
name: "Logger",
platforms: [
.macOS(.v10_13), .iOS(.v12), .tvOS(.v12), .watchOS(.v5)
],
products: [
.library(
name: "Logger",
targets: ["Logger"]),
.library(
name: "LoggerUI",
targets: ["LoggerUI"]),
.library(
name: "LoggerKit",
targets: ["LoggerKit"]),
.library(
name: "LoggerTestSupport",
targets: ["LoggerTestSupport"]),
.executable(
name: "LoggerExample",
targets: ["LoggerExample"]
)
],
products: products,
dependencies: [
],
targets: [
Expand All @@ -49,6 +57,5 @@ let package = Package(
.testTarget(
name: "LoggerKitTests",
dependencies: ["LoggerKit", "LoggerTestSupport"]),
],
swiftLanguageVersions: [.v4_2]
]
)
9 changes: 6 additions & 3 deletions Sources/Logger/Channel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,16 @@ public class Channel {

public func debug(_ logged : @autoclosure () -> Any, file: StaticString = #file, line: UInt = #line, column: UInt = #column, function: StaticString = #function) {
#if DEBUG
log(logged, file: file, line: line, column: column, function: function)
if (enabled) {
log(logged(), file: file, line: line, column: column, function: function)
}
#endif
}

public func fatal(_ logged : @autoclosure () -> Any, file: StaticString = #file, line: UInt = #line, column: UInt = #column, function: StaticString = #function) -> Never {
log(logged, file: file, line: line, column: column, function: function)
manager.fatalHandler(logged(), self, file, line)
let value = logged()
log(value, file: file, line: line, column: column, function: function)
manager.fatalHandler(value, self, file, line)
}
}

Expand Down

0 comments on commit 6375bbc

Please sign in to comment.