Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logger: refactored default LogLevel definition #1934

Merged
merged 2 commits into from
Sep 23, 2022
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
15 changes: 10 additions & 5 deletions Sources/Logging/Logger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ public typealias LogHandler = (_ level: LogLevel,
_ message: String) -> Void

enum Logger {
#if DEBUG
static var logLevel: LogLevel = .debug
#else
static var logLevel: LogLevel = .info
#endif

static var logLevel: LogLevel = Self.defaultLogLevel
static var logHandler: VerboseLogHandler = Self.defaultLogHandler

static let defaultLogHandler: VerboseLogHandler = { level, message, file, functionName, line in
Expand All @@ -72,6 +69,14 @@ enum Logger {

static var verbose: Bool = false

private static let defaultLogLevel: LogLevel = {
#if DEBUG
return .debug
#else
return .info
#endif
}()

internal static let frameworkDescription = "Purchases"

static func debug(_ message: @autoclosure () -> CustomStringConvertible,
Expand Down