Log SDK

更新时间:
复制 MD 格式

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
IMSLogLevelVerbose

Usage 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");