Skip to content
Open
Show file tree
Hide file tree
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
28 changes: 4 additions & 24 deletions Sources/AppLogger/AppLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,9 @@ public struct AppLogger: AppLogging {
"\(file.components(separatedBy: "/").last ?? "---") - \(function) - line \(line)"
}

// MARK: - Default Print
// MARK: - Print Tags
public static func print(
tag: DefaultLogType = .debug,
_ items: Any...,
separator: String = " ",
file: String = #file,
function: String = #function,
line: Int = #line)
{
#if DEBUG
guard isLoggerEnabled else { return }

let output = items.map { "\($0)" }.joined(separator: separator)

logStrategy.log(message: "\(tag.label)\n\(output)",
tag: tag,
category: formatLocationInfo(file: file, function: function, line: line))
#endif
}

// MARK: - Print Custom Tags
public static func printCustom(
tag: (any LogType)? = nil,
tag: (any LogType) = DefaultLogType.debug,
_ items: Any...,
separator: String = " ",
file: String = #file,
Expand All @@ -66,8 +46,8 @@ public struct AppLogger: AppLogging {

let output = items.map { "\($0)" }.joined(separator: separator)

logStrategy.log(message: "\(tag?.label ?? "")\n\(output)",
tag: tag ?? logStrategy.defaultLogType,
logStrategy.log(message: "\(tag.label)\n\(output)",
tag: tag,
category: formatLocationInfo(file: file, function: function, line: line))
#endif
}
Expand Down
9 changes: 1 addition & 8 deletions Sources/AppLogger/AppLogging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,12 @@ public protocol AppLogging {
/// - function: source function of log
/// - line: file's line number of log
static func print(
tag: DefaultLogType,
tag: (any LogType),
_ items: Any...,
separator: String,
file: String,
function: String,
line: Int)

static func printCustom(tag: (any LogType)?,
_ items: Any...,
separator: String,
file: String,
function: String,
line: Int)
}

// MARK: - Logging Tag
Expand Down