-
Notifications
You must be signed in to change notification settings - Fork 0
Context
Egor Badmaev edited this page Dec 5, 2022
·
2 revisions
An object that defines details about log's calling.
struct Context-
let file: String: The name of the file and module in which it appears. -
let function: String: The name of the declaration in which it appears. -
let line: Int: The line number on which it appears.
-
var description: String: Description of the log context. It is a computed property, that returns string:var description: String { return "In \(file): \(function) method on line \(line)" }
Initializes structure with full properties. All properties are optional to simplify creation using memberwise initializer in unit-tests.
#fileID, #function and #line are Literal Expressions.
init(file: String = #fileID,
function: String = #function,
line: Int = #line) {
self.file = file
self.function = function
self.line = line
}