The Log SDK is a basic dependency that lets you print unified client logs, control log levels, and fence logs by module.
Initialization
Import the header file into your project.
#import <IMSLog/IMSLog.h>// Set the log output level for all module tags.
[IMSLog setAllTagsLevel:IMSLogLevelAll];
// Optional: Specify whether to enable console output for logs. Disable this feature in the release version.
[IMSLog showInConsole:YES];The levels are as follows.
IMSLogLevelError
IMSLogLevelWarning
IMSLogLevelInfo
IMSLogLevelDebug
IMSLogLevelVerboseUsage instructions
The following example shows an API call.
// IMSLog provides module-based log fencing.
// Register a tag before use. Use the module name as the tag.
[IMSLog registerTag:@"IMSApiClient"];
// Optional: Specify the log output level for a specific tag.
[IMSLog setLevel:IMSLogLevelDebug forTag:@"IMSApiClient"]
···
IMSLogError(tag,frmt,...)
IMSLogWarn(tag,frmt,...)
IMSLogInfo(tag,frmt,...)
IMSLogDebug(tag,frmt,...)
IMSLogVerbose(tag,frmt,...)
For example:
IMSLogError(@"IMSApiClient", @"Error: %@", @"token expired");该文章对您有帮助吗?