Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.1
3.0.2
28 changes: 14 additions & 14 deletions Sources/LoggerAPI/Logger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ public class Log {
/// - Parameter fileName: The file of the source code of the function invoking the
/// logger API. Defaults to the file of the actual function
/// invoking this function.
public static func verbose(_ msg: String, functionName: String = #function,
public static func verbose(_ msg: @autoclosure () -> String, functionName: String = #function,
lineNum: Int = #line, fileName: String = #file ) {
if let logger = logger, logger.isLogging(.verbose) {
logger.log( .verbose, msg: msg,
logger.log( .verbose, msg: msg(),
functionName: functionName, lineNum: lineNum, fileName: fileName)
}
}
Expand All @@ -123,10 +123,10 @@ public class Log {
/// - Parameter fileName: The file of the source code of the function invoking the
/// logger API. Defaults to the file of the actual function
/// invoking this function.
public class func info(_ msg: String, functionName: String = #function,
public class func info(_ msg: @autoclosure () -> String, functionName: String = #function,
lineNum: Int = #line, fileName: String = #file) {
if let logger = logger, logger.isLogging(.info) {
logger.log( .info, msg: msg,
logger.log( .info, msg: msg(),
functionName: functionName, lineNum: lineNum, fileName: fileName)
}
}
Expand All @@ -143,10 +143,10 @@ public class Log {
/// - Parameter fileName: The file of the source code of the function invoking the
/// logger API. Defaults to the file of the actual function
/// invoking this function.
public class func warning(_ msg: String, functionName: String = #function,
public class func warning(_ msg: @autoclosure () -> String, functionName: String = #function,
lineNum: Int = #line, fileName: String = #file) {
if let logger = logger, logger.isLogging(.warning) {
logger.log( .warning, msg: msg,
logger.log( .warning, msg: msg(),
functionName: functionName, lineNum: lineNum, fileName: fileName)
}
}
Expand All @@ -163,10 +163,10 @@ public class Log {
/// - Parameter fileName: The file of the source code of the function invoking the
/// logger API. Defaults to the file of the actual function
/// invoking this function.
public class func error(_ msg: String, functionName: String = #function,
public class func error(_ msg: @autoclosure () -> String, functionName: String = #function,
lineNum: Int = #line, fileName: String = #file) {
if let logger = logger, logger.isLogging(.error) {
logger.log( .error, msg: msg,
logger.log( .error, msg: msg(),
functionName: functionName, lineNum: lineNum, fileName: fileName)
}
}
Expand All @@ -183,10 +183,10 @@ public class Log {
/// - Parameter fileName: The file of the source code of the function invoking the
/// logger API. Defaults to the file of the actual function
/// invoking this function.
public class func debug(_ msg: String, functionName: String = #function,
public class func debug(_ msg: @autoclosure () -> String, functionName: String = #function,
lineNum: Int = #line, fileName: String = #file) {
if let logger = logger, logger.isLogging(.debug) {
logger.log( .debug, msg: msg,
logger.log( .debug, msg: msg(),
functionName: functionName, lineNum: lineNum, fileName: fileName)
}
}
Expand All @@ -203,10 +203,10 @@ public class Log {
/// - Parameter fileName: The file of the source code of the function invoking the
/// logger API. Defaults to the file of the actual function
/// invoking this function.
public class func entry(_ msg: String, functionName: String = #function,
public class func entry(_ msg: @autoclosure () -> String, functionName: String = #function,
lineNum: Int = #line, fileName: String = #file) {
if let logger = logger, logger.isLogging(.entry) {
logger.log(.entry, msg: msg,
logger.log(.entry, msg: msg(),
functionName: functionName, lineNum: lineNum, fileName: fileName)
}
}
Expand All @@ -223,10 +223,10 @@ public class Log {
/// - Parameter fileName: The file of the source code of the function invoking the
/// logger API. Defaults to the file of the actual function
/// invoking this function.
public class func exit(_ msg: String, functionName: String = #function,
public class func exit(_ msg: @autoclosure () -> String, functionName: String = #function,
lineNum: Int = #line, fileName: String = #file) {
if let logger = logger, logger.isLogging(.exit) {
logger.log(.exit, msg: msg,
logger.log(.exit, msg: msg(),
functionName: functionName, lineNum: lineNum, fileName: fileName)
}
}
Expand Down