Function DTLog(_:level:filePath:functionName:lineNumber:)
public func DTLog(_ message: Any = "", level: LogLevel = .info, filePath: String = #file, functionName: String = #function, lineNumber: Int = #line)
Provides a nicely formatted log output with the file, function, and line number the log statement came from. Also includes a timestamp with millisecond accuracy.
Here are some examples of the output format:
2021-01-11 02:01:28.084 l:122 Authentication.swift getActiveAccessToken(comple... Authentication successful
2021-01-11 02:04:32.512 l:94 main.swift main() Fetched 28 devices
2021-01-11 02:04:31.506 l:108 main.swift main() 🐛 This is a debug log
2021-01-11 02:04:31.507 l:109 main.swift main() ⚠️ This is a warning
2021-01-11 02:04:31.507 l:110 main.swift main() ❌ This is an error
Parameters
Name | Type | Description |
---|---|---|
message | Any |
The thing that should be log. This will be converted to a |
level | LogLevel |
The severity of the log. Will be used as a prefix before |
filePath | String |
Should be left as-is to get the correct file path. |
functionName | String |
Should be left as-is to get the correct function name. |
lineNumber | Int |
Should be left as-is to get the correct line number. |