debuggerLogger.h
debuggerLogger.m
#import <Foundation/Foundation.h>
enum {
General=0,
Information = 1,
Warning = 2,
Error = 3,
Critical = 4
}; typedef NSUInteger logType;
enum {
noLog=0,
critical=1,
error=2,
warning=3,
info=4,
debug=5,
allLogs=6
};
typedef NSUInteger logLevel;
#define logTypeString(enum)[@[@"General",@"Information",@"Warning",@"Error",@"Critical"] objectAtIndex:enum]
enum {value1=1, value2=2, value3=3}; typedef NSUInteger myValue;
#define myValueString(enum) [@[@"value1",@"value2",@"value3"] objectAtIndex:enum]
static logLevel logLevelValue = 6;
@interface DebugLogger : NSObject
{
}
+(void)logText :(NSString *)textString :(logType)type;
+(void)logString :(NSString *)textString :(NSString *)valueString :(logType)type;
+(void)logMutableDic :(NSString *)textString :(NSMutableDictionary *)mutableDicValue :(logType)type;
+(void)logMutableArray :(NSString *)textString :(NSMutableArray *)mutableArrayValue :(logType)type;
+(void)logNoramlDict :(NSString *)textString :(NSDictionary *)dicValue :(logType)type;
+(void)logNormalArray :(NSString *)textString :(NSArray *)arryValue :(logType)type;
@end
debuggerLogger.m
#import "DebugLogger.h"
static DebugLogger *debugLoggerSingleTonObj = nil;
@implementation DebugLogger
//log only text
+(void)logText :(NSString *)textString :(logType)type
{
switch (logLevelValue)
{
case 1:
if(type==4)
{
//NSLog(@"'%@': %@",logTypeString(type),textString);
}
break;
case 2:
if(type==4 || type==3)
{
//NSLog(@"'%@': %@",logTypeString(type),textString);
}
break;
case 3:
if(type==4 || type==3 || type==2)
{
//NSLog(@"'%@': %@",logTypeString(type),textString);
}
break;
case 4:
if(type==1)
{
//NSLog(@"'%@': %@",logTypeString(type),textString);
}
break;
case 5:
if(type==1 || type==2)
{
//NSLog(@"'%@': %@",logTypeString(type),textString);
}
break;
case 6:
if(type==4 || type==3 || type==2 || type==1)
{
NSLog(@"'%@': %@",logTypeString(type),textString);
}
break;
default:
break;
}
}
//log string value
+(void)logString :(NSString *)textString :(NSString *)valueString :(logType)type
{
NSString *finalString = [NSString stringWithFormat:@" %@ : %@",textString,valueString];
[self logText :finalString :type];
}
//log muatble dictonary
+(void)logMutableDic :(NSString *)textString :(NSMutableDictionary *)mutableDicValue :(logType)type
{
NSString *finalString = [NSString stringWithFormat:@" %@ : %@",textString,mutableDicValue];
[self logText :finalString :type];
}
//log muatble array
+(void)logMutableArray :(NSString *)textString :(NSMutableArray *)mutableArrayValue :(logType)type
{
NSString *finalString = [NSString stringWithFormat:@" %@ : %@",textString,mutableArrayValue];
[self logText :finalString :type];
}
//log normal dicatonary
+(void)logNoramlDict :(NSString *)textString :(NSDictionary *)dicValue :(logType)type
{
NSString *finalString = [NSString stringWithFormat:@" %@ : %@",textString,dicValue];
[self logText :finalString :type];
}
//log normal array
+(void)logNormalArray :(NSString *)textString :(NSArray *)arryValue :(logType)type
{
NSString *finalString = [NSString stringWithFormat:@" %@ : %@",textString,arryValue];
[self logText :finalString :type];
}
@end
Sign up here with your email
ConversionConversion EmoticonEmoticon