Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 14 additions & 28 deletions Sources/Log/Classes/Models/LogLevel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Foundation
// MARK: - LogLevel

/// A set that includes all log levels.
public struct LogLevel: OptionSet {
public struct LogLevel: OptionSet, Sendable {
// MARK: Initialization

/// Creates a new log level.
Expand All @@ -22,33 +22,19 @@ public struct LogLevel: OptionSet {

public typealias RawValue = UInt

#if swift(>=6.0)
/// Creates a new default `.off` instance with a bitmask of `1 << 0`.
public nonisolated(unsafe) static let off = LogLevel(rawValue: offBitmask)
/// Creates a new default `.debug` instance with a bitmask of `1 << 1`.
public nonisolated(unsafe) static let debug = LogLevel(rawValue: debugBitmask)
/// Creates a new default `.info` instance with a bitmask of `1 << 2`.
public nonisolated(unsafe) static let info = LogLevel(rawValue: infoBitmask)
/// Creates a new default `.error` instance with a bitmask of `1 << 3`.
public nonisolated(unsafe) static let error = LogLevel(rawValue: errorBitmask)
/// Creates a new default `.fault` instance with a bitmask of `1 << 4`.
public nonisolated(unsafe) static let fault = LogLevel(rawValue: faultBitmask)
/// Creates a new default `.error` instance.
public nonisolated(unsafe) static let all = LogLevel(rawValue: allBitmask)
#else
/// Creates a new default `.off` instance with a bitmask of `1 << 0`.
public static let off = LogLevel(rawValue: offBitmask)
/// Creates a new default `.debug` instance with a bitmask of `1 << 1`.
public static let debug = LogLevel(rawValue: debugBitmask)
/// Creates a new default `.info` instance with a bitmask of `1 << 2`.
public static let info = LogLevel(rawValue: infoBitmask)
/// Creates a new default `.error` instance with a bitmask of `1 << 3`.
public static let error = LogLevel(rawValue: errorBitmask)
/// Creates a new default `.fault` instance with a bitmask of `1 << 4`.
public static let fault = LogLevel(rawValue: faultBitmask)
/// Creates a new default `.error` instance.
public static let all = LogLevel(rawValue: allBitmask)
#endif
/// Creates a new default `.off` instance with a bitmask of `1 << 0`.
public static let off = LogLevel(rawValue: offBitmask)
/// Creates a new default `.debug` instance with a bitmask of `1 << 1`.
public static let debug = LogLevel(rawValue: debugBitmask)
/// Creates a new default `.info` instance with a bitmask of `1 << 2`.
public static let info = LogLevel(rawValue: infoBitmask)
/// Creates a new default `.error` instance with a bitmask of `1 << 3`.
public static let error = LogLevel(rawValue: errorBitmask)
/// Creates a new default `.fault` instance with a bitmask of `1 << 4`.
public static let fault = LogLevel(rawValue: faultBitmask)
/// Creates a new default `.error` instance.
public static let all = LogLevel(rawValue: allBitmask)

/// Returns the raw bitmask value of the LogLevel and satisfies the `RawRepresentable` protocol.
public let rawValue: RawValue

Expand Down