-
Notifications
You must be signed in to change notification settings - Fork 0
Logger
Egor Badmaev edited this page Dec 5, 2022
·
6 revisions
A utility for writing string messages in debug mode.
Writes a message to the log using the specified log type.
Signature:
public static func log(_ message: @autoclosure () -> String, logType: LogType, shouldLogContext: Bool = true, file: String = #fileID, function: String = #function, line: Int = #line)-
message: log message -
logType: log type. -
shouldLogContext: defines whether to logContextor not. -
file: The name of the file and module in which it appears. -
function: The name of the declaration in which it appears. -
line: The line number on which it appears.
messageis a closure in order to add the ability to create a string to log inside method's calling.It is
@autoclosurein order to simplify usage. More on Swift Docs
Creates log with provided information.
Signature:
static func createLog(logType: LogType, message: @autoclosure () -> String, shouldLogContext: Bool, context: Context = Context()) -> String-
message: log message -
logType: log type. -
shouldLogContext: defines whether to logContextor not. -
file: The name of the file and module in which it appears. -
function: The name of the declaration in which it appears. -
line: The line number on which it appears.
This method has
internalaccess-level in order to call it inside unit-tests.
Prints message when debug mode is active.
Signature:
private static func debugPrint(_ message: String)-
message: log message withStringtype to print