You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.6 KiB

//
// RTKLog.h
// RTKLEFoundation
//
// Created by jerome_gu on 2019/1/21.
// Copyright © 2019 Realtek. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/*!
* Represents available facility used for identity the log message destination.
*/
typedef enum : NSUInteger {
RTKLogFacilityDefault, /* Direct log to NSLog */
RTKLogFacilityCocoaLumberjack __attribute((availability(ios,unavailable))) __attribute((availability(macos,unavailable))), // Direct log to CocoaLumberjack. Not support
RTKLogFacilityCustom, // Direct log to a custom C function which is set by -setLogger: method.
} RTKLogFacility;
/**
* Log level of the RTKLog facility.
*/
typedef NS_ENUM(NSUInteger, RTKLogLevel) {
RTKLogLevelOff = 0,
RTKLogLevelError,
RTKLogLevelWarning,
RTKLogLevelInfo,
RTKLogLevelDebug,
RTKLogLevelVerbose,
};
/**
* RTKLog is a logging facility which used by Realtek SDKs.
* @discussion Several API is public for control the log level and logging destination.
*/
@interface RTKLog : NSObject
/*!
* Change the logging direction.
* @discussion When set to RTKLogFacilityCustom, a custom logger C function should be set by call +setLogger: before.
*/
+ (void)setFacility:(RTKLogFacility)facility;
/**
* Pass a C function to receive the log message.
*/
+ (void)setLogger:(void(*)(NSString*))logFunc;
/**
* Set log level of this module
* @see RTKLogLevel
*/
+ (void)setLogLevel:(RTKLogLevel)level;
/**
* Log method used internal. Don't use it directly.
*/
+ (void)_logWithLevel:(RTKLogLevel)level format:(NSString *)format, ...;
@end
NS_ASSUME_NONNULL_END