Skip to content

Commit

Permalink
Fix Swift 6 concurrency errors
Browse files Browse the repository at this point in the history
- Remove the protocol for now, move the isLoggingEnabled to the init
  • Loading branch information
backslash-f committed Dec 12, 2024
1 parent c4b1ce3 commit 9c4fa50
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 33 deletions.
20 changes: 2 additions & 18 deletions Sources/ALMA/ALMA+Logging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,6 @@ public enum ALMALoggingCategory: String {
case error = "ALMA_Error"
}

public extension ALMA {

// MARK: Enable / Disable Logging

/// Enables / disables logging information via `AppLogger`.
///
/// When logging is enabled, the output will be available in *Xcode's Console* or
/// in the *macOS Console app*.
///
/// In the **macOS Console app**, you can filter ALMA's output by
/// `SUBSYSTEM`: `com.backslash-f.ALMA`.
func setLogging(enabled: Bool) {
ALMA.isLoggingEnabled = enabled
}
}

// MARK: - Internal

internal extension ALMA {
Expand All @@ -34,7 +18,7 @@ internal extension ALMA {
/// - Parameters:
/// - information: The `String` to be logged.
/// - category: A member of the `ALMALoggingCategory` enum.
static func log(information: String, category: ALMALoggingCategory) {
func log(information: String, category: ALMALoggingCategory) {
guard isLoggingEnabled else {
return
}
Expand All @@ -43,7 +27,7 @@ internal extension ALMA {
logger.log(information)
}

static func logError(_ error: String) {
func logError(_ error: String) {
log(information: error, category: .error)
}
}
9 changes: 0 additions & 9 deletions Sources/ALMA/ALMA+Protocol.swift

This file was deleted.

22 changes: 16 additions & 6 deletions Sources/ALMA/ALMA.swift
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
public struct ALMA: ALMAProtocol {
public struct ALMA {

// MARK: - Properties

// MARK: Internal Properties

/// Enables / disables logging output to both *Xcode's Console* and the macOS *Console app*. `true` by default.
internal static var isLoggingEnabled: Bool = true
/// Enables / disables logging information via `AppLogger`.
///
/// When logging is enabled, the output will be available in *Xcode's Console* or
/// in the *macOS Console app*.
///
/// In the **macOS Console app**, you can filter ALMA's output by
/// `SUBSYSTEM`: `com.backslash-f.ALMA`.
let isLoggingEnabled: Bool

// MARK: - Lifecycle

public init() {
ALMA.log(

/// Creates an ``ALMA`` instance.
///
/// - Parameter isLoggingEnabled: defaults to `true`.
public init(isLoggingEnabled: Bool = true) {
self.isLoggingEnabled = isLoggingEnabled
log(
information: "💪🏻 Armored, sharpened, and raring to go!",
category: .lifecycle
)
Expand Down

0 comments on commit 9c4fa50

Please sign in to comment.