Logs Output - fan-ADN/nendSDK-iOS GitHub Wiki

You can control log output on nend by using the NADLogger class.

Log level

By setting the log level, you can control the type of output log.
Log level settings are below:

Level Details Note
NADLogLevelDebug Output Debug info to Log
NADLogLevelInfo Output info to Log Output about succeed process, result, etc.
NADLogLevelWarn Output warning to Log No images or invalid parameter, etc.
NADLogLevelError Output error to log Output about failed process, result, etc.
NADLogLevelOff You cannot output to log Default
Swift
import NendAd

// Output warning to Log
NADLogger.setLogLevel(.Warn)
Objective-C
#import <NendAd/NADLogger.h>

// Output warning to Log
[NADLogger setLogLevel:NADLogLevelWarn];

Override log output: optional

You can override the log output process by setting the class conforming to the NADLogging protocol to logger.

e.g. Set the AppDelegate class to logger.

Swift
import NendAd

class AppDelegate: UIResponder, UIApplicationDelegate, NADLogging {

...

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        NADLogger.setLogLevel(.debug)
        NADLogger.sharedInstance().logger = self

        return true
    }

...

    // MARK: - NADLogging
    func logMessage(_ message: String!, logLevel: NADLogLevel) {
        print("logMessage : \(message!), logLevel : \(logLevel.rawValue)")
    }

...

}
Objective-C
#import <NendAd/NADLogger.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate,NADLogging>
...
@end

...

@implementation AppDelegate

...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [NADLogger setLogLevel:NADLogLevelDebug];
    [NADLogger sharedInstance].logger = self;
    return YES;
}

...

#pragma mark -  NADLogging
- (void)logMessage:(NSString *)message logLevel:(NADLogLevel)logLevel {
    NSLog(@"logMessage : %@ logLevel = %ld", message, (long)logLevel);
}

...

@end
⚠️ **GitHub.com Fallback** ⚠️