From a6c107550adedf09c72f7b0611646aec3f9431cf Mon Sep 17 00:00:00 2001 From: An Tran Date: Sun, 27 Mar 2022 21:08:27 +0800 Subject: [PATCH] Use String instead of StaticString to be more inline with swift-log behaviour --- Sources/Logging/DiagnosticsLogger.swift | 4 ++-- Sources/Logging/Loggable.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Logging/DiagnosticsLogger.swift b/Sources/Logging/DiagnosticsLogger.swift index ee9354f..ddd8702 100644 --- a/Sources/Logging/DiagnosticsLogger.swift +++ b/Sources/Logging/DiagnosticsLogger.swift @@ -62,7 +62,7 @@ public final class DiagnosticsLogger { /// - file: The file from which the log is send. Defaults to `#file`. /// - function: The functino from which the log is send. Defaults to `#function`. /// - line: The line from which the log is send. Defaults to `#line`. - public static func log(message: String, file: StaticString = #file, function: StaticString = #function, line: UInt = #line) { + public static func log(message: String, file: String = #file, function: String = #function, line: UInt = #line) { standard.log(LogItem(.debug(message: message), file: file, function: function, line: line)) } @@ -73,7 +73,7 @@ public final class DiagnosticsLogger { /// - file: The file from which the log is send. Defaults to `#file`. /// - function: The functino from which the log is send. Defaults to `#function`. /// - line: The line from which the log is send. Defaults to `#line`. - public static func log(error: Error, description: String? = nil, file: StaticString = #file, function: StaticString = #function, line: UInt = #line) { + public static func log(error: Error, description: String? = nil, file: String = #file, function: String = #function, line: UInt = #line) { standard.log(LogItem(.error(error: error, description: description), file: file, function: function, line: line)) } } diff --git a/Sources/Logging/Loggable.swift b/Sources/Logging/Loggable.swift index 394d6ff..0096dba 100644 --- a/Sources/Logging/Loggable.swift +++ b/Sources/Logging/Loggable.swift @@ -101,7 +101,7 @@ struct LogItem: Loggable { let message: String let cssClass: LoggableCSSClass? - init(_ type: LogType, file: StaticString, function: StaticString, line: UInt) { + init(_ type: LogType, file: String, function: String, line: UInt) { let file = String(describing: file).split(separator: "/").last.map(String.init) ?? String(describing: file) prefix = "\(file):L\(line)" self.message = type.message