Logger
-
A logging framework that can print messages to the console, store them locally on the device, and send them to the Mobile Analytics service. With each log message, additional information is gathered such as the file, function, and line where the log was created, as well as the severity of the message.
Multiple
Logger
instances can be created with different names usinglogger(name:)
.When logging, choose the log method that matches the severity of the message. For example, use
debug(message:)
for fine-detail information anderror(message:)
for unintended failures. To limit which logs get printed to the console and stored on the device, set thelogLevelFilter
property.To enable logs to be stored locally on the device, set
isLogStorageEnabled
totrue
. Logs are added to the log file until the file size is greater than themaxLogStoreSize
. At this point, the first half of the stored logs will be deleted to make room for new log data.To send logs to the Mobile Analytics service, use
send(completionHandler:)
. When the log data is successfully uploaded, the logs will be deleted from local storage.Note
TheLogger
class sets an uncaught exception handler to log application crashes. If you wish to set your own exception handler, do so before callinglogger(name:)
, or theLogger
exception handler will be overwritten.Declaration
Swift
public class Logger
-
The severity of the log message.
When setting
See moreLogger.logLevelFilter
, the LogLevels, ordered from most restrictive to least, are:none
,analytics
,fatal
,error
,warn
,info
, anddebug
.Declaration
Swift
public enum LogLevel : Int