Skip to content

Commit

Permalink
Merge branch 'develop' into IOS-3219_create_wallet_from_seed
Browse files Browse the repository at this point in the history
  • Loading branch information
tureck1y authored Mar 28, 2023
2 parents 06f04d7 + e2604c2 commit 1310337
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion TangemSdk/TangemSdk/Common/Core/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public struct Config {
public var cardIdDisplayFormat: CardIdDisplayFormat = .full

/// Logger configuration
public var logConfig: Log.Config = .debug
public var logConfig: Log.Config = .default

/// ScanTask or scanCard method in TangemSdk class will use this mode to attest the card
public var attestationMode: AttestationTask.Mode = .normal
Expand Down
10 changes: 7 additions & 3 deletions TangemSdk/TangemSdk/Common/Log/Log.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ import Foundation
private let logger = Log()

public class Log {
public static var config: Log.Config = .verbose {
public static var config: Config = .default {
didSet {
logger.logLevel = config.logLevel
logger.loggers = config.loggers
}
}

private(set) var logLevel: [Log.Level] = []
private(set) var logLevel: [Log.Level] = Log.config.logLevel

private(set) var loggers: [TangemSdkLogger] = []
private(set) var loggers: [TangemSdkLogger] = Log.config.loggers

fileprivate init() {}

public static func warning<T>(_ message: @autoclosure () -> T) {
logger.logInternal(message(), level: .warning)
Expand Down Expand Up @@ -136,6 +138,8 @@ public extension Log {
case verbose
case custom(logLevel: [Log.Level],
loggers: [TangemSdkLogger] = [ConsoleLogger()])

static var `default`: Log.Config = .debug

internal var logLevel: [Log.Level] {
switch self {
Expand Down

0 comments on commit 1310337

Please sign in to comment.