Skip to content

Commit

Permalink
OSLogger: Fixed issue where debug level log messages were being log…
Browse files Browse the repository at this point in the history
…ged in non-DEBUG builds
  • Loading branch information
orchetect committed Sep 20, 2022
1 parent d964615 commit dce669d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
11 changes: 10 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,16 @@ let package = Package(
targets: [
.target(
name: "OTCore",
dependencies: []
dependencies: [],
swiftSettings: [
.define(
"DEBUG",
.when(
platforms: [.iOS, .macOS, .tvOS, .watchOS],
configuration: .debug
)
)
]
),

.testTarget(
Expand Down
10 changes: 3 additions & 7 deletions Sources/OTCore/Logging/OSLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ public class OSLogger {
column: Int = #column,
function: String = #function
) {
#if RELEASE

// do not post debug messages to the log in a Release build

#else
#if DEBUG

guard enabled else { return }

Expand Down Expand Up @@ -337,8 +333,8 @@ public class OSLogger {
column: Int = #column,
function: String = #function
) {
#if RELEASE
// do not post debug messages to the log in a Release build
#if !DEBUG
// do not post debug messages to the log in a non-Debug build
if level == .debug { return }
#endif

Expand Down

0 comments on commit dce669d

Please sign in to comment.